clone_permission_handler 1.1.0

Flutter Permission handler Plugin #

pub package

A permissions plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.

BranchBuild Status
developBuild Status
masterBuild Status

Features #

  • Check if a permission is granted.
  • Request permission for a specific feature.
  • Open app settings so the user can enable a permission.
  • Show a rationale for requesting permission (Android).

Usage #

To use this plugin, add permission_handler as a dependency in your pubspec.yaml file. For example:

  permission_handler: '^2.2.0'

NOTE: There's a known issue with integrating plugins that use Swift into a Flutter project created with the Objective-C template. See issue Flutter#16049 for help on integration.


Requesting permission #

import 'package:permission_handler/permission_handler.dart';

Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler().requestPermissions([PermissionGroup.contacts]);

Checking permission #

import 'package:permission_handler/permission_handler.dart';

PermissionStatus permission = await PermissionHandler().checkPermissionStatus(PermissionGroup.contacts);

Checking service status #

import 'package:permission_handler/permission_handler.dart';

ServiceStatus serviceStatus = await PermissionHandler().checkServiceStatus(PermissionGroup.location);

Checking the service status only makes sense for the PermissionGroup.location on Android and the PermissionGroup.location, PermissionGroup.locationWhenInUser, PermissionGroup.locationAlways or PermissionGroup.sensors on iOS. All other permission groups are not backed by a separate service and will always return ServiceStatus.notApplicable.

Open app settings #

import 'package:permission_handler/permission_handler.dart';

bool isOpened = await PermissionHandler().openAppSettings();

Show a rationale for requesting permission (Android only) #

import 'package:permission_handler/permission_handler.dart';

bool isShown = await PermissionHandler().shouldShowRequestPermissionRationale(PermissionGroup.contacts);

This will always return false on iOS.

List of available permissions #

Defines the permission groups for which permissions can be checked or requested.

enum PermissionGroup {
  /// The unknown permission only used for return type, never requested

  /// Android: Calendar
  /// iOS: Calendar (Events)

  /// Android: Camera
  /// iOS: Photos (Camera Roll and Camera)

  /// Android: Contacts
  /// iOS: AddressBook

  /// Android: Fine and Coarse Location
  /// iOS: CoreLocation (Always and WhenInUse)

  /// Android: Microphone
  /// iOS: Microphone

  /// Android: Phone
  /// iOS: Nothing

  /// Android: Nothing
  /// iOS: Photos

  /// Android: Nothing
  /// iOS: Reminders

  /// Android: Body Sensors
  /// iOS: CoreMotion

  /// Android: Sms
  /// iOS: Nothing

  /// Android: External Storage
  /// iOS: Nothing

  /// Android: Microphone
  /// iOS: Speech

  /// Android: Fine and Coarse Location
  /// iOS: CoreLocation - Always

  /// Android: Fine and Coarse Location
  /// iOS: CoreLocation - WhenInUse

  /// Android: None
  /// iOS: MPMediaLibrary

Status of the permission #

Defines the state of a permission group

enum PermissionStatus {
  /// Permission to access the requested feature is denied by the user.

  /// Permissions to access the feature is granted by the user but the feature is disabled.

  /// Permission to access the requested feature is granted by the user.

  /// The user granted restricted access to the requested feature (only on iOS).

  /// Permission is in an unknown state

Overview of possible service statuses #

Defines the state of the backing service for the supplied permission group

/// Defines the state of a service related to the permission group
enum ServiceStatus {
  /// The unknown service status indicates the state of the service could not be determined.

  /// There is no service for the supplied permission group.

  /// The service for the supplied permission group is disabled.

  /// The service for the supplied permission group is enabled.

Issues #

Please file any issues, bugs or feature request as an issue on our GitHub page.

Want to contribute #

If you would like to contribute to the plugin (e.g. by improving the documentation, solving a bug or adding a cool new feature), please carefully review our contribution guide and send us your pull request.

Author #

This Permission handler plugin for Flutter is developed by Baseflow. You can contact us at

1.1.0 #

  • remove unused permissions on iOS.


permission_handler_example #

Demonstrates how to use the permission_handler plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  clone_permission_handler: ^1.1.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:clone_permission_handler/clone_permission_handler.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Aug 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19
  • Flutter: 1.7.8+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (meta).


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
flutter 0.0.0
meta ^1.1.6 1.1.6 1.1.7
Transitive dependencies
collection 1.14.11 1.14.12
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8