permission_handler_package library
Permission Handler Package - Fully Automatic No manual handling required. Just add to your pubspec.yaml and it works.
Classes
- AppLifecycleObserver
- PermissionActionNotifier
- PermissionBuilder
- Rebuilds when permission status changes.
- PermissionChangeEvent
- PermissionDeniedDialog
-
Shown after a fresh (non-permanent) denial from
PermissionManager.requestPermission(). - PermissionHandler
- Initialize the permission handler package Call this as early as possible in your app, ideally before runApp() Example:
- PermissionInitialDialog
-
The default "why we need this" explanation popup, shown before a
permission is requested via
PermissionManager.requestPermission(). - PermissionManager
- PermissionNotifier
- PermissionPermanentDialog
-
The legacy popup shown when a permission is permanently denied, via
PermissionManager.requestPermission()directly orPermissionActionNotifier.showLegacyPermanentDenialDialog(). Not used by the canonical Riverpod flow, which showsPermissionScreeninstead — see the README's "Recommended API vs. legacy/compatibility API" section. - PermissionResult
- Snapshot of a single permission's status at a point in time.
- PermissionScreen
- A full-screen, platform-adaptive page for explaining a permission request or guiding the user to Settings.
- PermissionState
- PermissionTypeListKey
-
Family parameters need consistent
==/hashCodefor Riverpod's.familymodifier to work correctly — aList<PermissionType>literal does not have this ([a, b] != [a, b]for two separately constructed lists), which silently makes every rebuild of permissionsStatusProvider register as a brand-new provider instance instead of reusing the existing one. This key type wraps aList<PermissionType>in a stable, sorted, comma-joinedString—Stringhas genuine built-in value equality, so two lists with the same permissions (regardless of the order they were constructed in) now correctly resolve to the same provider. - PermissionWrapper
Enums
- PermissionGroup
- Logical groups of related PermissionTypes for batch requests / UI.
- PermissionScreenMode
- Which flavor of full-screen page to show. Distinct from the existing dialogs — this is a real, pushable screen (see spec items #3/#4), not a popup.
- PermissionType
- All runtime permissions supported by this package.
- PermissionUiState
- A single, unambiguous state for a permission's UI to react to, instead of inferring it from several independent booleans.
Extensions
Properties
-
permissionActionProvider
→ StateNotifierProvider<
PermissionActionNotifier, AsyncValue< void> > -
final
-
permissionGroupStatusProvider
→ FutureProviderFamily<
bool, PermissionGroup> -
final
-
permissionManagerProvider
→ Provider<
PermissionManager> -
final
-
permissionsStatusProvider
→ FutureProviderFamily<
Map< PermissionType, bool> , PermissionTypeListKey> -
final
-
permissionStateProvider
→ ChangeNotifierProvider<
PermissionNotifier> -
final
-
permissionStatusProvider
→ FutureProviderFamily<
bool, PermissionType> -
final
Functions
-
permissionsProcessingStream(
PermissionNotifier stateNotifier, List< PermissionType> permissions) → Stream<bool> -
Builds a
Stream<bool>reporting whether any ofpermissionscurrently reads as PermissionUiState.requesting or PermissionUiState.openingSettings onstateNotifier— i.e. "busy" from the caller's perspective. Feed this into PermissionScreen.externalProcessingStream so the screen's busy indicator reflects the real Riverpod-driven operation state instead of only its own local tracking. -
showCanonicalExplanationScreen(
{required BuildContext context, required List< PermissionType> permissions, String? title, String? message}) → Future<bool> -
Pushes the canonical pre-request explanation PermissionScreen
(
PermissionScreenMode.explanation) — the recommended-flow counterpart to showCanonicalSettingsRequiredScreen, used before the native OS permission prompt rather than after a permanent denial. NotPermissionInitialDialog, which remains available only as an explicit legacy/compatibility API. -
showCanonicalSettingsRequiredScreen(
{required BuildContext context, required PermissionNotifier stateNotifier, required List< PermissionType> permissions, required Future<bool> onOpenSettings(), String? title, String? message}) → Future<bool> -
Pushes the canonical settings-required PermissionScreen — the
single recommended UI for permanent denial across every
Riverpod-driven widget in this package (PermissionWrapper via
PermissionActionNotifier, and PermissionBuilder). Not
PermissionPermanentDialog, which remains available only as an explicit legacy/compatibility API for callers who want the old popup behavior on purpose.
Typedefs
-
PermissionExplanationCallback
= Future<
bool> Function(BuildContext context, PermissionType permission) -
A caller-supplied replacement for the built-in explanation dialog
shown before a single PermissionType is requested. Return
trueto proceed with the OS request,falseto treat it as a decline without ever prompting the OS.contextis the same context the request was made with (or the manager's tracked fallback context) — already known to be valid at the point this is called. -
PermissionGroupExplanationCallback
= Future<
bool> Function(BuildContext context, PermissionGroup group) - Same as PermissionExplanationCallback, but for a whole PermissionGroup requested together.