LevitRef class abstract
A bridge for interacting with the dependency injection system from a LevitStore.
LevitRef allows stores to find other dependencies, register new ones, and manage their own lifecycle via onDispose. It provides a scoped access to the Levit tree without needing global static access.
Constructors
- LevitRef()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → LevitScope
-
The LevitScope that owns this store instance.
no setter
Methods
-
autoDispose<
T> (T object) → T -
Registers
objectfor automatic cleanup when the store closes. -
bindExisting<
Alias, Concrete extends Alias> ({String? sourceTag, String? tag}) → void -
Binds
Aliasto an existing local singletonConcrete. -
find<
S> ({String? tag}) → S -
Finds an instance of type
Sin the current scope. -
findAsync<
S> ({String? tag}) → Future< S> -
Asynchronously finds an instance of type
Sin the current scope. -
findAsyncStore<
R> (LevitAsyncStore< R> store, {String? tag}) → Future<R> -
Asynchronously finds and resolves the value of async
storewithin the current scope. -
findStore<
R> (LevitStore< R> store, {String? tag}) → R -
Finds the value of
storewithin the current scope. -
findStoreAsync<
R> (LevitStore< R> store, {String? tag}) → Future<R> -
Asynchronously finds the value of
storewithin the current scope. -
lazyPut<
S> (S builder(), {String? tag, bool permanent = false, bool isFactory = false}) → void -
Lazily registers a dependency using
builder. -
lazyPutAsync<
S> (Future< S> builder(), {String? tag, bool permanent = false, bool isFactory = false}) → Future<S> Function() -
Lazily registers an asynchronous dependency using
builder. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
void callback()) → void -
Registers
callbackto run when the store instance is disposed. -
own<
T> (T object) → T -
Registers
objectfor automatic cleanup when the store closes. -
put<
S> (S builder(), {String? tag, bool permanent = false}) → S - Registers a dependency in the current scope.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited