Search packages, repositories and app categories

Package detailsv1.0.0+1

permission_asker

A wrapper for permission_handler which lifts some of the boilerplate needed to handle permissions in our apps.

AndroidiOS
30-day downloads
4
Likes
19
Pub points
130

Install package

flutter pub add permission_asker

Package Overview

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

Permission_Asker is a Flutter package that simplifies permission handling by wrapping the permission_handler library. It reduces boilerplate code required to request and manage permissions in Android and iOS apps, offering a cleaner, more concise API. The package streamlines common permission workflows, making it easier to check, request, and respond to permission statuses without repetitive code. Ideal for developers seeking a lightweight solution to improve code readability and maintainability when dealing with device permissions.

Use cases

  • Requesting camera access in a photo app
  • Handling location permissions in a navigation app
  • Managing storage access for file uploads
  • Checking microphone permissions before recording
  • Simplifying permission checks across multiple screens

Key features

  • Reduces boilerplate with clean API
  • Wraps permission_handler seamlessly
  • Supports Android and iOS platforms
  • Provides easy permission status checks
  • Offers intuitive request methods

Suitable for

  • Developers using permission_handler
  • Apps requiring frequent permission management
  • Teams prioritizing clean, readable code
  • Projects aiming to minimize repetitive permission logic
  • Flutter beginners learning permission handling

Considerations

  • Requires permission_handler as a dependency
  • Limited to basic permission operations
  • No built-in UI customization
  • Does not handle complex permission flows
  • Depends on underlying permission_handler behavior

Original README

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

permission_asker

A wrapper for permission_handler which lifts some of the boilerplate needed to handle permissions in our apps.

Why

Usually, when we need to build our widgets according to the permission status of a certain feature we need to check if the permission is granted or not and ask for it. Since these are async operations we usually need to add some boilerplate to do the right thing at the right time.

What

In addition to everything that's provided with permission_handler by exposing it, this package provides:

  • a PermissionAsker class which allows to ask permissions and react to the results via the onPermissionData callback.
  • a PermissionAskerBuilderclass which allows to build a widget according to the status of a list of permissions

Setup

Check here for setting up your permissions.

Usage

Here's an example on how you can use the PermissionAskerBuilder widget

PermissionAskerBuilder(
  permissions: [
      Permission.location,
      Permission.camera,
  ],
  grantedBuilder: (context) => Center(
      child: Text('All permissions granted!'),
  ),
  notGrantedBuilder: (context, notGrantedPermissions) => Center(
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
            Text('Not granted permissions:'),
            for (final p in notGrantedPermissions) 
              Text(p.toString())
        ],
      ),
  ),
  notGrantedListener: (notGrantedPermissions) => print('Not granted:\n$notGrantedPermissions'),
)

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.