passo_mobile_app/lib/utils/request_permission.dart

14 lines
326 B
Dart

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;
}