passo_mobile_app/lib/utils/request_permission.dart

14 lines
326 B
Dart
Raw Permalink Normal View History

2023-08-27 08:38:05 +00:00
import 'package:permission_handler/permission_handler.dart';
Future<bool> requestPermission(Permission permission) async {
if (await permission.isGranted) {
return true;
} else {
var result = await permission.request();
if (result == PermissionStatus.granted) {
return true;
}
}
return false;
}