PolicyEngineController class final

Mutable state controller for the policy engine.

Wraps PolicyEngine and exposes reactive state for the widget tree. Notify listeners after any mutation so PolicyEngineScope rebuilds its dependants automatically.

Inheritance

Constructors

PolicyEngineController({required PolicyEngine engine})
Creates a PolicyEngineController with an explicit engine.
PolicyEngineController.inMemory({ILogger? logger, IAssetLoader? assetLoader})
Creates a PolicyEngineController using an in-memory repository.
factory
PolicyEngineController.withRepository({required IPolicyRepository repository, ILogger? logger, IAssetLoader? assetLoader})
Creates a PolicyEngineController with a custom IPolicyRepository.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
Whether any listeners are currently registered.
no setterinherited
isInitialized bool
Whether the controller has been initialised with at least one policy load.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addRole(RoleEntity role) Future<Result<void, DomainFailure>>
Adds or replaces role in the repository and notifies listeners.
dispose() → void
Discards any resources used by the object.
inherited
evaluateAccess(String roleName, String resourceId) Future<Result<AccessDecision, DomainFailure>>
Evaluates whether roleName can access resourceId.
listRoles() Future<Result<List<RoleEntity>, DomainFailure>>
Returns all currently loaded roles.
loadPolicies(Map<String, dynamic> policyMap) Future<Result<void, DomainFailure>>
Loads policies from an in-memory policyMap (v2 schema).
loadPoliciesFromAsset(String assetPath) Future<Result<void, DomainFailure>>
Loads policies from the Flutter asset at assetPath.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeRole(String roleName) Future<Result<void, DomainFailure>>
Removes the role named roleName and notifies listeners.
toString() String
A string representation of this object.
inherited
updateRole(String roleName, RoleEntity newRole) Future<Result<void, DomainFailure>>
Replaces the role named roleName with newRole and notifies listeners.

Operators

operator ==(Object other) bool
The equality operator.
inherited