PermissionObserver class abstract
One place to watch every permission decision — for analytics ("how many users deny the camera on the KYC screen?"), crash reporting, or logs.
class AnalyticsPermissionObserver extends PermissionObserver {
@override
void onResult(PermissionResult result) => analytics.log(
'permission_${result.permission.name}',
{'state': result.state.name, 'requested': result.requested},
);
}
Every method has a no-op default. Callbacks are wrapped in try/catch,
so a throwing observer cannot break a request — but its error is
swallowed, not reported.
Constructors
- PermissionObserver()
-
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDialogResult(
PermissionDialogKind kind, List< AppPermission> permissions, PermissionDialogAction action) → void -
onDialogShown(
PermissionDialogKind kind, List< AppPermission> permissions) → void -
onError(
Object error, StackTrace stackTrace, String where) → void -
Something failed and was contained — a platform call, a store, a
dialog.
wherenames the step. -
onResult(
PermissionResult result) → void -
Fires once per permission at the end of every
request/requestManyandopenSettingsAndRecheck, with the final result. Not fired for plain checks. -
onSettingsOpened(
List< AppPermission> permissions) → void - The user was sent to the Settings app (or a service settings screen).
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited