easy_permissions_handler 1.0.0 copy "easy_permissions_handler: ^1.0.0" to clipboard
easy_permissions_handler: ^1.0.0 copied to clipboard

Simplify permission requests and checks. Handle mandatory/optional permissions with custom dialogs if needed.

EasyPermissionHandler Plugin v1.0.0 #

EasyPermissionHandler is a Flutter plugin that simplifies permission requests and checks with additional features, making it easier to handle permissions in your Flutter app.

Features #

  • Handles permission requests and checks for a specific permission.
  • Allows specifying whether the permission is mandatory or optional.
  • Provides options to handle custom description dialogs for permission requests.
  • Supports handling permanently denied permissions with customizable callbacks.
  • Automatically resumes the app after showing permission dialogs for a better user experience.

Installation #

To use EasyPermissionHandler in your Flutter project, add the following to your pubspec.yaml file:

dependencies:
  easy_permissions_handler: ^1.0.0

Usage #

  1. Import the easy_permissions_handler package in your Dart file:
import 'package:easy_permission/easy_permissions_handler.dart';
  1. Create an instance of EasyPermissionHandler with required parameters:
Future<bool> isGranted() async{
  EasyPermissionHandler(
    permission: Permission.camera,
    isRequired: true,
    onResumed: () {
      // Handle app resuming after permission dialog is shown.
    },
    customDescriptionFuture: _showCustomDescriptionDialog(),
    onDeniedForeverFeature: _handleDeniedForever(),
  ).handlePermission();
}
  1. Handle the permission based on your requirements:
Future<void> checkAndRequestPermission() async {
  bool isGranted = await permissionModule.handlePermission();

  if (isGranted) {
    // Permission is granted. Proceed with your app logic.
  } else {
    // Permission not granted or required. Handle the case accordingly.
  }
}
  1. Optionally, handle the app resuming after permission dialog:
@override
void onResume() {
  super.onResume();
  permissionModule.handleOnResumed();
}

Note #

Make sure to add the required permissions to your AndroidManifest.xml and Info.plist files for Android and iOS, respectively.

For more information, refer to the permission_handler package documentation.

Contributions #

Contributions are welcome! If you find any issues or want to enhance the functionality of the EasyPermissionHandler plugin, feel free to create a pull request.

License #

This project is licensed under the MIT License - see the LICENSE file for details.

GitHub #

The source code for the EasyPermission plugin can be found on GitHub: EasyPermission Repository.


Please note that the `github` link provided is a placeholder and should be replaced with the actual link to your GitHub repository for the `EasyPermission` plugin.
2
likes
150
pub points
60%
popularity

Publisher

unverified uploader

Simplify permission requests and checks. Handle mandatory/optional permissions with custom dialogs if needed.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, permission_handler

More

Packages that depend on easy_permissions_handler