ZenithUserScope class
A ZenithTenantScope extended with workspace-scoped child scopes, implementing the 3-tier hierarchy:
AppScope (application lifecycle)
└─ ZenithUserScope (account identity, profile, credentials)
└─ ZenithWorkspaceScope (tenant DB, outbox, project nodes)
Switching workspaces disposes the ZenithWorkspaceScope without logging
out the user or destroying the ZenithUserScope.
- Inheritance
-
- Object
- ZenithTenantScope
- ZenithUserScope
Constructors
- ZenithUserScope(String id)
-
Creates a ZenithUserScope with
id.
Properties
- container → ZenithContainer
-
The isolated dependency container for this scope.
finalinherited
-
disposalComplete
→ Future<
void> -
Completion and errors of asynchronous cleanup started by dispose.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
The stable identifier for this scope (e.g. a user-id or 'anon_123').
finalinherited
- isClosing → bool
-
Whether teardown has begun. New scoped work is rejected while closing.
no setterinherited
- isDisposed → bool
-
Whether this scope has been disposed.
no setterinherited
- isDormant → bool
-
Whether this scope is dormant (biometric lock active).
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispose(
{bool purgeZeroize = false}) → void -
Immediately disposes this scope: cancels tokens, fires dispose callbacks,
optionally zeroizes Zeroizable nodes, then disposes the container.
override
-
drainAndDispose(
{Duration timeout = const Duration(milliseconds: 500), bool purgeZeroize = false}) → Future< void> -
Awaits all registered ZenithDrainables then calls dispose.
inherited
-
drainOwnedScopes(
{required Duration timeout, required bool purgeZeroize}) → Future< void> -
Override to drain currently owned child scopes before disposal.
override
-
endWorkspaceScope(
String workspaceId) → void -
Immediately disposes the workspace scope for
workspaceId. -
endWorkspaceScopeAsync(
String workspaceId, {Duration timeout = const Duration(milliseconds: 500)}) → Future< void> -
Two-phase workspace disposal — awaits drainables with
timeout. -
getOrCreateWorkspaceScope(
String workspaceId) → ZenithTenantScope -
Returns the existing workspace scope for
workspaceId, or creates one. -
hasWorkspaceScope(
String workspaceId) → bool -
Whether a workspace scope for
workspaceIdcurrently exists. -
listenToInterIsolateInvalidations(
String portName, {required void onInvalidate(String workspaceId)}) → void -
Listens for ZenithInvalidateMessages on an IsolateNameServer port.
inherited
-
markActive(
) → void -
Restores this scope from dormant state.
inherited
-
markDormant(
) → void -
Puts this scope into dormant (biometric-locked) state.
inherited
-
maybeNode<
T> (ZenithKey< T> key) → ZenithNode<T> ? -
Returns the node for
keyif registered, or null.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
void callback()) → void -
Registers
callbackto be invoked when this scope is disposed.inherited -
onDisposeAsync(
Future< void> callback()) → void -
Registers resource cleanup that drainAndDispose will await.
After disposal, await the returned disposalComplete for cleanup errors.
inherited
-
register<
T> (ZenithKey< T> key, T factory(), {ZenithLifetime lifetime = ZenithLifetime.scoped}) → void -
Registers
keywith afactoryin the container, tagging it withlifetimefor Captive Dependency Guard enforcement.inherited -
registerDrainable(
ZenithDrainable drainable) → void -
Registers
drainableto be awaited during two-phase scope teardown.inherited -
resolve<
T> (ZenithKey< T> key) → T -
Resolves the value for
keyfrom this scope's container.inherited -
runGuarded(
Future< void> task()) → void -
Runs
taskguarded so that scope disposal automatically cancels it.inherited -
runWithToken(
Future< void> task(ZenithCancellationToken token)) → void -
Runs
taskproviding a ZenithCancellationToken that is cancelled when this scope is disposed.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited