zeb_permissions_helper 1.0.0
zeb_permissions_helper: ^1.0.0 copied to clipboard
A flexible, customizable permission helper for Flutter apps. Handles permission flows, platform special-cases (iOS notifications / location), and provides developer-friendly defaults.
๐ก๏ธ Zeb Permissions Helper #
A powerful, flexible Flutter package that simplifies managing permissions across different libraries โ with customizable UI dialogs, sequential flows, and unified APIs.
๐ Overview #
zeb_permissions_helper provides a consistent and developer-friendly way to request permissions in Flutter apps.
It allows you to:
- Choose which underlying package to use for specific permissions
(e.g.,
locationfor GPS,permission_handlerfor camera/mic). - Display purpose dialogs explaining why a permission is needed.
- Request single, multiple, or sequential permissions with minimal code.
- Handle results, errors, and fallbacks gracefully across iOS and Android.
๐ฆ Installation #
Add to your pubspec.yaml:
dependencies:
zeb_permissions_helper: ^1.0.0
Then run:
flutter pub get
โ๏ธ Import #
import 'package:zeb_permissions_helper/zeb_permissions_helper.dart';
๐งฉ Basic Usage #
โ Single Permission
final helper = ZebPermissionsHelper();
final result = await helper.requestPermission(
context,
Permission.camera,
requestConfig: const SingleRequestConfig(
showPurposeDialog: true,
dialogText: DialogText(
title: 'Camera Access Required',
explanation: 'We need camera access to let you capture profile photos.',
caution: 'Please enable this permission in settings if denied.',
),
),
);
print('Granted: ${result.isGranted}, Used package: ${result.usedPackage}');
๐ Multiple Permissions #
final results = await helper.requestMultiplePermissions(
context,
[Permission.camera, Permission.microphone, Permission.photos],
requestConfigs: {
Permission.camera: const SingleRequestConfig(showPurposeDialog: false),
},
);
for (final r in results) {
print('${r.permission}: ${r.isGranted ? "GRANTED" : "DENIED"}');
}
๐ Sequential Flow (Onboarding Style) #
final results = await helper.requestPermissionsSequentially(
context,
sequentialConfig: SequentialRequestConfig(
permissions: [
Permission.camera,
Permission.location,
Permission.notification,
],
packageOverrides: {
Permission.location: PermissionPackage.location,
Permission.notification: PermissionPackage.notifications,
},
showPurposeDialogs: true,
delayBetweenRequests: Duration(milliseconds: 500),
),
);
for (final r in results) {
print('${r.permission}: ${r.isGranted ? "GRANTED" : "DENIED"}');
}
๐ง Key Features #
| Feature | Description |
|---|---|
| ๐งฉ Unified API | Request permissions using one consistent interface. |
| ๐งญ Multi-package support | Choose between permission_handler, location, or custom packages. |
| ๐ฌ Purpose dialogs | Inform users why you need a permission before requesting it. |
| โฑ Sequential requests | Handle onboarding-style permission flows easily. |
| โ๏ธ Highly configurable | Customize delay, UI, and package mapping. |
| ๐งพ Structured results | Access isGranted, usedPackage, and error fields. |
๐งช Example App #
This package includes a full example app demonstrating:
- Single permission flow
- Multiple permissions
- Sequential permission onboarding
- Custom dialog texts
- Status checks and edge cases
Run the example:
cd example
flutter run
๐งฐ Classes & Configs #
ZebPermissionsHelper
The main class used to handle permission requests.
SingleRequestConfig
Configuration for a single permission request:
package: choose which library to usedialogText: customize the dialog textshowPurposeDialog: whether to show a pre-request dialog
SequentialRequestConfig
Controls sequential permission requests:
permissions: list of permissions to requestpackageOverrides: map of permission โ packageshowPurposeDialogs: whether to show purpose dialogs before each requestdelayBetweenRequests: optional delay between each step
DialogText
Defines the title, explanation, and caution messages shown in dialogs.
๐งพ Example UI Scenarios #
You can test the flows directly from the example appโs home page:
| Example | Description |
|---|---|
| Single Permission | Requests a single permission with or without a custom dialog. |
| Multiple Permissions | Requests several permissions simultaneously. |
| Sequential Flow | Demonstrates onboarding-style permission handling. |
| Status Check | Checks if a permission is already granted. |
| Edge Case Test | Tests unknown permissions and fallback handling. |
๐ฑ Platform Support #
| Platform | Supported | Notes |
|---|---|---|
| Android | โ | Integrates with permission_handler / location |
| iOS | โ | Works with iOS permission APIs |
| Web | โ ๏ธ | Limited, depending on the chosen package |
๐งฉ Dependencies #
permission_handlerlocation- (Optionally) other permission-specific packages
๐งโ๐ป Contributing #
Contributions, issues, and feature requests are welcome! Feel free to open a PR or issue on GitHub.
๐ License #
This project is licensed under the MIT License.
๐ Author #
Developed by Sufi Aurangzeb Hossain
Simplifying permission handling for every Flutter app.
๐ช Badges #
[](https://pub.dev/packages/zeb_permissions_helper)
[](https://pub.dev/packages/zeb_permissions_helper)
[](https://pub.dev/packages/zeb_permissions_helper)
[](https://pub.dev/packages/zeb_permissions_helper)
Would you like me to include a License file (MIT) and example folder structure section for your repo as well (so your GitHub looks professional and ready for pub.dev)?