ZenithScopeManager class

Manages the root application scope and all tenant child scopes.

final manager = ZenithScopeManager();
final userScope = manager.getOrCreateScope('user_123');
manager.endScope('user_123');

Constructors

ZenithScopeManager()

Properties

appScope → ZenithTenantScope
The root application-level scope (singleton lifetime).
final
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

endScope(String id, {bool purgeZeroize = false}) → void
Immediately disposes the scope for id and removes it from the registry.
endScopeAsync(String id, {Duration timeout = const Duration(milliseconds: 500), bool purgeZeroize = false}) → Future<void>
Two-phase scope teardown: awaits registered drainables with timeout before disposing the scope.
getOrCreateScope(String id) → ZenithTenantScope
Returns the existing scope for id, or creates a new ZenithTenantScope.
getOrCreateUserScope(String id) → ZenithUserScope
Returns the existing ZenithUserScope for id, or creates one.
hasScope(String id) → bool
Returns whether a scope with id is currently active.
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

Static Methods

bootstrapHeadless({required String tenantId, Object? storageFactory(String tenantId)?}) → Future<ZenithTenantScope>
Creates a minimal headless ZenithTenantScope for background isolates or Workmanager tasks — does not require Flutter bindings.