import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:permission_handler/permission_handler.dart'; final permissionRepositoryProvider = Provider((_) { return PermissionRepository(); }); class PermissionRepository implements IPermissionRepository { PermissionRepository(); @override Future hasLocationWhenInUsePermission() { return Permission.locationWhenInUse.isGranted; } @override Future requestLocationWhenInUsePermission() async { final result = await Permission.locationWhenInUse.request(); return result.isGranted; } @override Future hasLocationAlwaysPermission() { return Permission.locationAlways.isGranted; } @override Future requestLocationAlwaysPermission() async { final result = await Permission.locationAlways.request(); return result.isGranted; } @override Future openSettings() { return openAppSettings(); } } abstract interface class IPermissionRepository { Future hasLocationWhenInUsePermission(); Future requestLocationWhenInUsePermission(); Future hasLocationAlwaysPermission(); Future requestLocationAlwaysPermission(); Future openSettings(); }