Permission class
Represents a single permission request with its metadata
This class encapsulates all the information needed to request and display a specific permission to the user. It includes optional display information that can be used to provide context about why the permission is needed.
Example usage:
// Using constructor with custom name and description
final cameraPermission = Permission(
name: 'Camera Access',
description: 'Allow the app to take photos and record videos',
type: PermissionType.camera,
);
// Using static convenience methods (name and description will be null)
final cameraPermission = Permission.camera;
final photosPermission = Permission.photos;
final microphonePermission = Permission.microphone;
Constructors
- Permission({String? name, String? description, required PermissionType type})
- Creates a new Permission instance
Properties
- description → String?
-
A detailed description explaining why this permission is needed
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String?
-
The display name for this permission
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → PermissionType
-
The type of permission being requested
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → Map< String, dynamic> - Converts this Permission instance to a JSON-serializable Map
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- bluetooth → Permission
-
Creates a bluetooth permission with no custom name or description
no setter
- calendar → Permission
-
Creates a calendar permission with no custom name or description
no setter
- camera → Permission
-
Creates a camera permission with no custom name or description
no setter
- contacts → Permission
-
Creates a contacts permission with no custom name or description
no setter
- health → Permission
-
Creates a health permission with no custom name or description
no setter
- location → Permission
-
Creates a location permission with no custom name or description
no setter
- microphone → Permission
-
Creates a microphone permission with no custom name or description
no setter
- motion → Permission
-
Creates a motion permission with no custom name or description
no setter
- music → Permission
-
Creates a music permission with no custom name or description
no setter
- notification → Permission
-
Creates a notification permission with no custom name or description
no setter
- photos → Permission
-
Creates a photos permission with no custom name or description
no setter
- reminder → Permission
-
Creates a reminder permission with no custom name or description
no setter
- siri → Permission
-
Creates a Siri permission with no custom name or description
no setter
- speech → Permission
-
Creates a speech recognition permission with no custom name or description
no setter
- tracking → Permission
-
Creates a tracking permission with no custom name or description
no setter