AccessContext — a generic interface for access evaluation.
This interface abstracts permission, role, and feature flag checks away from the Flutter BuildContext, enabling usage in DI layers, BLoC, Riverpod, or anywhere outside the widget tree.
Type parameters:
R
— Role type (e.g.,String
,enum Role
)P
— Permission type (e.g.,String
,enum Permission
)F
— Feature flag type (e.g.,String
,enum FeatureFlag
)
Example:
final class SessionContext implements AccessContext<Role, Permission, FeatureFlag> {
...
}
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
hasPermission(
P permission) → bool -
Returns
true
if the user has the specified permission. -
hasRole(
R role) → bool -
Returns
true
if the user has the specified role. -
isFeatureEnabled(
F flag) → bool -
Returns
true
if the specified feature flag is enabled. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited