PermissionHandler class

A singleton class that manages and checks various permissions required by the application.

The PermissionHandler provides methods to check and request permissions such as camera, microphone, bluetooth, storage, contacts, location, notification, biometric, calendar, and sensors. It maintains the current state of each permission and exposes getters to check if a specific permission is granted.

Usage:

Example:

PermissionHandler.instance.init([Permission.camera, Permission.microphone]);
bool isCameraGranted = PermissionHandler.instance.isCameraPermissionGranted;
await PermissionHandler.instance.requestPermission(Permission.camera);

Note: The permission types should match the constants defined in the Permission class.

Properties

hashCode int
The hash code for this object.
no setterinherited
isBiometricPermissionGranted bool
Returns true if biometric permission is granted.
no setter
isBluetoothPermissionGranted bool
Returns true if bluetooth permission is granted.
no setter
isCalendarPermissionGranted bool
Returns true if calendar permission is granted.
no setter
isCameraPermissionGranted bool
Returns true if camera permission is granted.
no setter
isContactsPermissionGranted bool
Returns true if contacts permission is granted.
no setter
isLocationPermissionGranted bool
Returns true if location permission is granted.
no setter
isMicrophonePermissionGranted bool
Returns true if microphone permission is granted.
no setter
isNotificationPermissionGranted bool
Returns true if notification permission is granted.
no setter
isSensorsPermissionGranted bool
Returns true if sensors permission is granted.
no setter
isStoragePermissionGranted bool
Returns true if storage permission is granted.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

checkPermission(String type) Future<bool>
Checks if the specified permission type is granted.
init(List<String> checkPermissionList) → void
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openSettings() Future<void>
requestPermission(String type) Future<bool>
Requests the specified permission type from the user.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance PermissionHandler
final