simple_permissions 0.1.8

Simple Permissions #

A new flutter plugin for checking and requesting permissions on iOs and Android.

Getting Started #

Make sure you add the needed permissions to your Android Manifest Permission and Info.plist.

<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


List of currently available permissions #

enum Permission {
  // Microphone

  // Camera

  // Read External Storage (Android)

  // Write External Storage (Android)

  // Access Coarse Location (Android) / When In Use iOS

  // Access Fine Location (Android) / When In Use iOS

  // Access Fine Location (Android) / When In Use iOS

  // Access Fine Location (Android) / Always Location iOS

  // Write contacts (Android) / Contacts iOS

  // Read contacts (Android) / Contacts iOS
/// Permissions status enum (iOS)
enum PermissionStatus { notDetermined, restricted, denied, authorized }

Methods #

  /// Check a [permission] and return a [Future] with the result
  static Future<bool> checkPermission(Permission permission);

  /// Request a [permission] and return a [Future] with the result
  static Future<bool> requestPermission(Permission permission);

  /// Open app settings on Android and iOS
  static Future<bool> openSettings();
  /// Get iOs permission status 
  static Future<PermissionStatus> getPermissionStatus(Permission permission)

[0.1.8] - 24.09.2018

  • Targeting Android API 27

[0.1.7] - 11.09.2018

  • Android Send SMS

[0.1.6] - 10.08.2018

  • See commits for changelogs

[0.1.5] - 22.05.2018

  • Added Vibrate (Android)

[0.1.4] - 11.05.2018

  • Added Read External Storage (Android)

[0.1.3] - 01.05.2018

  • Added contact permission

[0.1.2] - 13.04.2018

  • Added method for getting permission status from iOs

[0.1.1] - 26.03.2018

  • Fix for Dart 2.0 compatibility

[0.1.0] - 14.03.2018

  • Initial release


import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:simple_permissions/simple_permissions.dart';

void main() => runApp(new MyApp());

class MyApp extends StatefulWidget {
  _MyAppState createState() => new _MyAppState();

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  Permission permission;

  initState() {

  // Platform messages are asynchronous, so we initialize in an async method.
  initPlatformState() async {
    String platformVersion;
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await SimplePermissions.platformVersion;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;

  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: new Text('Plugin example app'),
        body: new Center(
          child: new Column(children: <Widget>[
            new Text('Running on: $_platformVersion\n'),
            new DropdownButton(
                items: _getDropDownItems(),
                value: permission,
                onChanged: onDropDownChanged),
            new RaisedButton(
                onPressed: checkPermission,
                child: new Text("Check permission")),
            new RaisedButton(
                onPressed: requestPermission,
                child: new Text("Request permission")),
            new RaisedButton(
                onPressed: getPermissionStatus,
                child: new Text("Get permission status")),
            new RaisedButton(
                onPressed: SimplePermissions.openSettings,
                child: new Text("Open settings"))

  onDropDownChanged(Permission permission) {
    setState(() => this.permission = permission);

  requestPermission() async {
    final res = await SimplePermissions.requestPermission(permission);
    print("permission request result is " + res.toString());

  checkPermission() async {
    bool res = await SimplePermissions.checkPermission(permission);
    print("permission is " + res.toString());

  getPermissionStatus() async {
    final res = await SimplePermissions.getPermissionStatus(permission);
    print("permission status is " + res.toString());

  List<DropdownMenuItem<Permission>> _getDropDownItems() {
    List<DropdownMenuItem<Permission>> items = new List();
    Permission.values.forEach((permission) {
      var item = new DropdownMenuItem(
          child: new Text(getPermissionString(permission)), value: permission);
    return items;

Use this package as a library

1. Depend on it

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

  simple_permissions: ^0.1.8

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:simple_permissions/simple_permissions.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 Jul 11, 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.3


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field was unreachable.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


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