PermissionResult class

The outcome of checking or requesting one AppPermission.

Never thrown, always returned: a failed platform call comes back as PermissionState.error with error and stackTrace set.

Constructors

PermissionResult({required AppPermission permission, required PermissionState state, PermissionState? initialState, bool requested = false, bool openedSettings = false, bool declinedByUser = false, Map<Permission, PermissionStatus> statuses = const {}, String? reason, Object? error, StackTrace? stackTrace})
const

Properties

changed → bool
Whether the call changed the state — denied became granted, say.
no setter
declinedByUser → bool
Whether the user turned down one of the package's own dialogs — "Not now" on the rationale or the denied/Settings dialog. Useful for not asking again this session.
final
error → Object?
final
hashCode → int
The hash code for this object.
no setterinherited
initialState → PermissionState?
The state before this call did anything. null for a plain check, where it would always equal state.
final
isAllowed → bool
See PermissionStateGetters.isAllowed — the getter to branch on.
no setter
isDenied → bool
no setter
isError → bool
no setter
isGranted → bool
no setter
isLimited → bool
no setter
isNotApplicable → bool
no setter
isPermanentlyDenied → bool
no setter
isRestricted → bool
no setter
isServiceDisabled → bool
no setter
openedSettings → bool
Whether the user was sent to the Settings app during this call.
final
permission → AppPermission
final
reason → String?
Why the permission is PermissionState.notApplicable here.
final
requested → bool
Whether the OS was actually asked — a system prompt was requested. false when the permission was already allowed, when the user said "Not now" to the rationale, or when only Settings could help.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace → StackTrace?
final
state → PermissionState
The final state, after any dialogs, retries and trips to Settings.
final
statuses → Map<Permission, PermissionStatus>
The raw status of every native permission behind permission, for when the folded state hides a detail you need — background location denied while foreground location is granted, say.
final

Methods

copyWith({PermissionState? state, PermissionState? initialState, bool? requested, bool? openedSettings, bool? declinedByUser, Map<Permission, PermissionStatus>? statuses, String? reason, Object? error, StackTrace? stackTrace}) → PermissionResult
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
override

Operators

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