SingleScopeHandler<T> class abstract

Manages the lifecycle of dependencies within a specific scope.

When Weaver enters or leaves a scope with a name matching scopeName, this handler is notified and calls onEnterScope or onLeaveScope accordingly.

T is the type of arguments required when entering the scope.

Constructors

SingleScopeHandler(Weaver weaver, {Stream<Scope<T>?>? changeScopeStream})
Creates a SingleScopeHandler for weaver.

Properties

currentScope Scope<T>?
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scopeName String
The name of the scope this handler manages.
no setterinherited
stream Stream<Scope<T>?>
latefinalinherited
weaverInstance ScopeHandlerWeaverProxy
The Weaver proxy used to manage dependencies within this scope.
final

Methods

canHandleScope(String scope) bool
clearAllRegisteredObjects() Future<void>
dispose() → void
inherited
ensureEnterScope() Future<Scope<T>>
This method can be used to wait and ensure for enter scope. If scope has already entered Returns current scope.
inherited
handle(HandlerEvent event) Future<void>
Handles the scope state transition by checking if the scope is currently active in weaverInstance.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onEnterScope(Weaver weaver, T argument) Future<void>
Called when the scope is entered. Dependencies should be registered here.
onLeaveScope(Weaver weaver) Future<void>
Called when the scope is left. Cleanup or custom un-registration should happen here.
toString() String
A string representation of this object.
inherited

Operators

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