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 object for automatic cleanup when the store closes.
bindExisting<Alias, Concrete extends Alias>({String? sourceTag, String? tag}) → void
Binds Alias to an existing local singleton Concrete.
find<S>({String? tag}) → S
Finds an instance of type S in the current scope.
findAsync<S>({String? tag}) Future<S>
Asynchronously finds an instance of type S in the current scope.
findAsyncStore<R>(LevitAsyncStore<R> store, {String? tag}) Future<R>
Asynchronously finds and resolves the value of async store within the current scope.
findStore<R>(LevitStore<R> store, {String? tag}) → R
Finds the value of store within the current scope.
findStoreAsync<R>(LevitStore<R> store, {String? tag}) Future<R>
Asynchronously finds the value of store within 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 callback to run when the store instance is disposed.
own<T>(T object) → T
Registers object for 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