14 lines
326 B
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;
|
||
|
}
|