permission_policy
3.2.1, released 4 months ago by nylo.dev
Role-based access control and hierarchical permissions management system for Flutter.
What it does
Provides type-safe permission and role management with inheritance, local caching, and custom storage support. Includes UI widgets like PermissionGuard, PermissionBuilder, and RoleSelector for conditional rendering.
AI-written summary of version 3.2.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need role-based access control (RBAC) in your Flutter app.
- You want hierarchical permissions and role inheritance.
- You need to guard specific UI components or routes based on device permissions.
Skip it when
- You need complex backend-driven user authentication and synchronization out of the box.
- You are looking for hardware device permission management like camera or location permissions.
Strengths
- Supports both permission and role inheritance with cycle detection.
- Includes customizable UI widgets (PermissionGuard, RoleSelector).
- Pluggable storage backend interface.
Weaknesses
- Completely rewritten in v3 with no automatic migration from v2.
- Device-level roles by default; user-identity mapping requires custom storage implementation.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Initialize the package using PermissionPolicy.instance.initialize() and configure permissions and roles.
await PermissionPolicy.instance.initialize();
await PermissionPolicy.instance.configureSimple({
'admin': ['read_posts', 'write_posts', 'delete_posts'],
});
bool canEdit = await PermissionPolicy.instance.hasPermission('write_posts');Alternatives
Packages that do the same job and could replace permission_policy.
- jni_flutter
Access Flutter Android APIs from Dart.
87Compare - nativeapi
Dart bindings to native system APIs across desktop and mobile
85Compare - shizuku_api
Flutter plugin to run shell commands via Shizuku without root
69Compare - flutter_app_update
A simple lightweight and customizable version update library for Flutter
61Compare
Works with
Packages commonly used together with permission_policy: ones it builds on, ones built on it, and its own family.
- nylo_supportpermission_policy depends on itSupport library for the Nylo framework offering routing, networking, storage, widgets and more.
- nylo_frameworkSame familyMicro-framework for Flutter with boilerplate, routing, MVC pattern, and CLI tooling.
- scaffold_uiSame familyCLI tool to quickly scaffold authentication flows and in-app purchases in Nylo projects.