PermissionRuleSet class
An ordered collection of PermissionRules with a default fallback level.
Rules are evaluated in priority order (lowest first). The first matching rule determines the PermissionDecision. If no rule matches, the defaultLevel is used.
Constructors
-
PermissionRuleSet({List<
PermissionRule> ? rules, PermissionLevel defaultLevel = PermissionLevel.ask})
Properties
-
activeRules
→ List<
PermissionRule> -
Only active (enabled, non-expired) rules.
no setter
- defaultLevel → PermissionLevel
-
Default permission level when no rule matches.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
rules
→ List<
PermissionRule> -
All rules in priority order.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addRule(
PermissionRule rule) → void - Add a rule, maintaining priority sort order.
-
evaluate(
PermissionRequest request) → PermissionDecision - Evaluate a PermissionRequest against all active rules.
-
evaluateWithCache(
PermissionRequest request, PermissionCache cache) → PermissionDecision - Evaluate and also check the cache first.
-
findRule(
String id) → PermissionRule? - Find a rule by ID.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
purgeExpired(
) → int - Remove all expired rules.
-
removeBySource(
String source) → int - Remove all rules from a given source.
-
removeRule(
String id) → bool - Remove a rule by ID. Returns true if found.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited