flutter_permissions_helper

A Flutter package for easily requesting permissions from the mobile OS, prompting the user to grant or deny access to the specified resource.

Based on the simple_permissions package. This package refactors the code into a more extensible structure and extends support to all mobile OS versions supported by Flutter.

Requirements

This package is compatable with all versions of Android or iOS that are compatable with Flutter. (Some specific permissions are restricted to certain versions. Details in the permissions reference table below.)

API Reference

static Future<bool> hasPermission(Permission)

Checks to see if the app has been granted access to a particular permission.

static Future<PermissionStatus> requestPermission(Permission)

Requests a permission from the mobile platform. This usually entails a display window showing on the app, asking the user if they would like to allow the app access to that permission.

If the permission has already been granted, this function will automatically return PermissionStatus.Granted.

static Future<PermissionStatus> getPermissionStatus(Permission)

Returns the exact PermissionStatus of a given permission.

enum Permission

An enum containing all the permissions this package supports requesting from the mobile platform.

See Permissions Reference below for a list of values.

enum PermissionStatus

An enum representing the status of permissions for the app. This enum is returned by several functions illustrating the state of the permission queried.

  • Undetermined: The default value for a permission that has not yet been requested.
  • Restricted: The permission has been granted but with restrictions on its functionality.
  • Denied: The permission has been denied by the user.
  • DeniedAndDisabled: The permission has been denied by the user and any further requests are automatically blocked. (Android only)
  • Granted: The permission has been granted.

Permissions Reference

Below is a list of permission codes supported by the plugin and their respective support on each mobile platform. Synonym means a permission is treated as though it is another permission type, usually as a means of convenience. Implicit means that it is not necessary to request the permission on that platform.

PermissioniOS SupportAndroid Support
AccessCourseLocationAny (Synonym: WHEN_IN_USE_LOCATION)Any
AccessFineLocationAny (Synonym: WHEN_IN_USE_LOCATION)Any
AlwaysLocationAnyAny (Synonym: ACCESS_FINE_LOCATION)
CallPhoneNot SupportedAny
CameraAnyAny
PhotoLibraryAnyNot Supported
ReadContacts9.0+Any
ReadExternalStorageAny (Implicit)Any
ReadPhoneStateNot SupportedAny
ReadSmsNot SupportedAny
RecordAudioAnyAny
VibrateNot ImplementedAny
WhenInUseLocationAnyAny (Synonym: ACCESS_FINE_LOCATION)
WriteContacts9.0+Any
WriteExternalStorageAny (Implicit)Any

Libraries

enums
permissions_helper

Dart

dart:ui
Built-in types and core primitives for a Flutter application. [...]

Core

dart:async
Support for asynchronous programming, with classes such as Future and Stream. [...]
dart:collection
Classes and utilities that supplement the collection support in dart:core. [...]
dart:convert
Encoders and decoders for converting between different data representations, including JSON and UTF-8. [...]
dart:core
Built-in types, collections, and other core functionality for every Dart program. [...]
dart:developer
Interact with developer tools such as the debugger and inspector. [...]
dart:math
Mathematical constants and functions, plus a random number generator. [...]
dart:typed_data
Lists that efficiently handle fixed sized data (for example, unsigned 8 byte integers) and SIMD numeric types. [...]

VM

dart:io
File, socket, HTTP, and other I/O support for non-web applications. [...]
dart:isolate
Concurrent programming using isolates: independent workers that are similar to threads but don't share memory, communicating only via messages. [...]