mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: auto request noti perm
This commit is contained in:
13
lib/core/utils/platform/perm.dart
Normal file
13
lib/core/utils/platform/perm.dart
Normal file
@@ -0,0 +1,13 @@
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
abstract final class PermUtils {
|
||||
static Future<bool> request(Permission permission) async {
|
||||
final status = await permission.status;
|
||||
if (status.isGranted) {
|
||||
return true;
|
||||
} else {
|
||||
final result = await permission.request();
|
||||
return result.isGranted;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user