super_easy_permissions

A flutter plugin for handling permissions on Android/iOS in a super simple way.

Please support me via Donation. Your donation seriously motivates me to build many useful plugins like this.

How to use

Step 1:

First add this package in your pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  super_easy_permissions: any

Make sure to GET all the pub packages after saving this file.

Step 2:

Android

Add the required permissions in your AndroidManifest.xml file:

<uses-permission android:name="android.permission.CAMERA" />
<uses-feature android:name="android.hardware.camera" />

In this case, I have added camera permission (which also require adding hardware feature). Your's case may be different. For example, You may require storage permissions.

NOTE: If you need to add storage permissions in AndroidManifest.xml, make sure to add the following line in manifest file:

<application
      android:requestLegacyExternalStorage="true"
      ...

For a list of all permissions, visit Google Developers site.

iOS

Add required permissions in Info.plist file:

<key>NSCameraUsageDescription</key>
<string>$(PRODUCT_NAME) camera description.</string>

In this case, I have added camera permission. Your need may be different. For a list of all permissions, visit Apple Developers site.

Step 3

Import the library in your dart file:

import 'package:super_easy_permissions/super_easy_permissions.dart';

Step 4

Finally, use the package

Check if permission is granted

bool result = await SuperEasyPermissions.isGranted(Permissions.camera);
if (result) {
  // Permission is granted, do something
}

Ask for permission

bool result = await SuperEasyPermissions.askPermission(Permissions.camera);
if (result) {
  // Permission is granted, do something
} else {
  // Permission denied, do something else
}

Check if permission is denied

bool result = await SuperEasyPermissions.isDenied(Permissions.camera);
if (result) {
  // Permission is denied, do something
}

Permissions Reference

  Permissions.accessMediaLocation        // for android only
  Permissions.activityRecognition        // for android only
  Permissions.bluetooth
  Permissions.calendar
  Permissions.camera
  Permissions.contacts
  Permissions.ignoreBatteryOptimizations // for ios only
  Permissions.location
  Permissions.locationAlways
  Permissions.locationWhenInUse
  Permissions.mediaLibrary               // for ios only
  Permissions.microphone
  Permissions.notification
  Permissions.phone                      // for android only
  Permissions.photos                     // for ios only
  Permissions.photosAddOnly              // for ios only
  Permissions.reminders                  // for ios only
  Permissions.sensors
  Permissions.sms                        // for android only
  Permissions.speech
  Permissions.storage

Other useful packages

References

Issues

Don't hesitate to email any issues or feature at riturajshakti@gmail.com.

Want to contribute

Please support me via Donation. Your donation seriously motivates me to develop more useful packages like this.

Author

This Permission plugin for Flutter is developed by Rituraj Shakti. You can contact me at riturajshakti@gmail.com