Search packages, repositories and app categories

Package detailsv5.0.1

easy_permission_validator

PermissonHandler is a package that manages permissions on Android and iOS, with this package you can find an easy way to use the PermissonHandler library.

AndroidiOSWindows
30-day downloads
129
Likes
36
Pub points
150

Install package

flutter pub add easy_permission_validator

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Easy Permission Validator is a Flutter package that simplifies permission management for Android and iOS, offering a straightforward interface to handle runtime permissions. It wraps the PermissionHandler library, enabling developers to request, check, and manage app permissions with minimal code. The package supports common permissions like camera, location, and storage, ensuring consistent behavior across platforms. It also provides clear feedback on permission status and handles edge cases such as denied or restricted access. Ideal for apps requiring user consent for sensitive features.

Use cases

  • Requesting camera access in a photo app
  • Checking location permissions before map usage
  • Managing storage access for file uploads
  • Handling runtime permissions in cross-platform apps
  • Ensuring compliance with privacy regulations

Key features

  • Simple API for permission checks
  • Supports Android and iOS
  • Handles permission status states
  • Built-in error handling
  • Cross-platform consistency

Suitable for

  • Mobile apps needing runtime permissions
  • Developers seeking quick permission integration
  • Apps targeting both Android and iOS
  • Projects prioritizing user privacy
  • Teams wanting minimal boilerplate

Considerations

  • Requires native configuration for some permissions
  • Limited to basic permission types
  • May need additional setup for Windows
  • Depends on underlying PermissionHandler library
  • Does not support custom permission groups

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Easy Permission Validator

This package is useful when you need to manage on-demand permissions for both Android and iOS.

pub package

Usage

To use this plugin, add easy_permission_validator as a dependency in your pubspec.yaml file.

Base use:

_permissionRequest() async {
  final permissionValidator = EasyPermissionValidator(
    context: context,
    appName: 'Easy Permission Validator',
  );
  var result = await permissionValidator.camera();
  if (result) {
    // Do something;
  }
}

You can add custom messages for other languages:

_permissionRequest() async {
  final permissionValidator = EasyPermissionValidator(
    context: context,
    appName: 'Easy Permission Validator',
    appNameColor: Colors.red,
    cancelText: 'Cancelar',
    enableLocationMessage:
        'Debe habilitar los permisos necesarios para utilizar la acción.',
    goToSettingsText: 'Ir a Configuraciones',
    permissionSettingsMessage:
        'Necesita habilitar los permisos necesarios para que la aplicación funcione correctamente',
  );
  var result = await permissionValidator.camera();
  if (result) {
    // Do something;
  }
}

In addition, you can add a custom Dialog:

_permissionWithCustomPopup() async {
  final permissionValidator = EasyPermissionValidator(
    context: context,
    appName: 'Easy Permission Validator',
    customDialog: MyAmazingCustomPopup(),
  );
  var result = await permissionValidator.camera();
  if (result) {
    // Do something;
  }
}

Caution

Some permissions must be in the privacy policy

Permissions

If you use any permissions from this package, you must add:

For iOS (add in ios/Runner/Info.plist):

  <!-- Permission options for the `location` group -->
  <key>NSLocationWhenInUseUsageDescription</key>
  <string>Need location when in use</string>
  <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
  <string>Always and when in use!</string>
  <key>NSLocationUsageDescription</key>
  <string>Older devices need location.</string>
  <key>NSLocationAlwaysUsageDescription</key>
  <string>Can I have location always?</string>

  <!-- Permission options for the `mediaLibrary` group -->
  <key>NSAppleMusicUsageDescription</key>
  <string>Music!</string>
  <key>kTCCServiceMediaLibrary</key>
  <string>media</string>

  <!-- Permission options for the `calendar` group -->
  <key>NSCalendarsUsageDescription</key>
  <string>Calendars</string>
  <key>NSCalendarsFullAccessUsageDescription</key>
  <string>Calendar full access</string>

  <!-- Permission options for the `camera` group -->
  <key>NSCameraUsageDescription</key>
  <string>camera</string>

  <!-- Permission options for the `contacts` group -->
  <key>NSContactsUsageDescription</key>
  <string>contacts</string>

  <!-- Permission options for the `microphone` group -->
  <key>NSMicrophoneUsageDescription</key>
  <string>microphone</string>

  <!-- Permission options for the `speech` group -->
  <key>NSSpeechRecognitionUsageDescription</key>
  <string>speech</string>

  <!-- Permission options for the `sensors` group -->
  <key>NSMotionUsageDescription</key>
  <string>motion</string>

  <!-- Permission options for the `photos` group -->
  <key>NSPhotoLibraryUsageDescription</key>
  <string>photos</string>

  <!-- Permission options for the `reminder` group -->
  <key>NSRemindersUsageDescription</key>
  <string>reminders</string>

  <!-- Permission options for the `bluetooth` -->
  <key>NSBluetoothAlwaysUsageDescription</key>
  <string>bluetooth</string>
  <key>NSBluetoothPeripheralUsageDescription</key>
  <string>bluetooth</string>

  <!-- Permission options for the `appTrackingTransparency` -->
  <key>NSUserTrackingUsageDescription</key>
  <string>appTrackingTransparency</string>

  <!-- Permission options for the `assistant` group -->
  <key>NSSiriUsageDescription</key>
  <string>The example app would like access to Siri Kit to demonstrate requesting authorization.</string>

For ANDROID (add in android/app/src/main/AndroidManifest.xml):

Permissions on Android

  <!--
  Internet permissions do not affect the `permission_handler` plugin, but are required if your app needs access to
  the internet.
  -->
  <uses-permission android:name="android.permission.INTERNET"/>

  <!-- Permissions options for the `contacts` group -->
  <uses-permission android:name="android.permission.READ_CONTACTS"/>
  <uses-permission android:name="android.permission.WRITE_CONTACTS"/>
  <uses-permission android:name="android.permission.GET_ACCOUNTS"/>

  <!-- Permissions options for the `storage` group -->
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
  <!-- Read storage permission for Android 12 and lower -->
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
  <!--
    Granular media permissions for Android 13 and newer.
    See https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions
    for more information.
  -->
  <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
  <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />
  <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" />

  <!-- Permissions options for the `camera` group -->
  <uses-permission android:name="android.permission.CAMERA"/>

  <!-- Permissions options for the `sms` group -->
  <uses-permission android:name="android.permission.SEND_SMS"/>
  <uses-permission android:name="android.permission.RECEIVE_SMS"/>
  <uses-permission android:name="android.permission.READ_SMS"/>
  <uses-permission android:name="android.permission.RECEIVE_WAP_PUSH"/>
  <uses-permission android:name="android.permission.RECEIVE_MMS"/>

  <!-- Permissions options for the `phone` group -->
  <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  <uses-permission android:name="android.permission.CALL_PHONE"/>
  <uses-permission android:name="android.permission.ADD_VOICEMAIL"/>
  <uses-permission android:name="android.permission.USE_SIP"/>
  <uses-permission android:name="android.permission.READ_CALL_LOG"/>
  <uses-permission android:name="android.permission.WRITE_CALL_LOG"/>
  <uses-permission android:name="android.permission.BIND_CALL_REDIRECTION_SERVICE"/>

  <!-- Permissions options for the `calendar` group -->
  <uses-permission android:name="android.permission.READ_CALENDAR" />
  <uses-permission android:name="android.permission.WRITE_CALENDAR" />

  <!-- Permissions options for the `location` group -->
  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

  <!-- Permissions options for the `microphone` or `speech` group -->
  <uses-permission android:name="android.permission.RECORD_AUDIO" />

  <!-- Permissions options for the `sensors` group -->
  <uses-permission android:name="android.permission.BODY_SENSORS" />
  <uses-permission android:name="android.permission.BODY_SENSORS_BACKGROUND" />

  <!-- Permissions options for the `accessMediaLocation` group -->
  <uses-permission android:name="android.permission.ACCESS_MEDIA_LOCATION" />

  <!-- Permissions options for the `activityRecognition` group -->
  <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />

  <!-- Permissions options for the `ignoreBatteryOptimizations` group -->
  <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

  <!-- Permissions options for the `nearby devices` group -->
  <uses-permission android:name="android.permission.BLUETOOTH" />
  <uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
  <uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
  <uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
  <uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />

  <!-- Permissions options for the `manage external storage` group -->
  <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

  <!-- Permissions options for the `system alert windows` group -->
  <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

  <!-- Permissions options for the `request install packages` group -->
  <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

  <!-- Permissions options for the `access notification policy` group -->
  <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>

  <!-- Permissions options for the `notification` group -->
  <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>

  <!-- Permissions options for the `alarm` group -->
  <uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />

Issues

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

Contributions

You can contribute by making a pull request, this package was made for the community and you have complete power to add whatever they find useful.

Categories

Dependencies

Dependency list 1 items

Source repository

Projects using this package

No data available yet.