Injectable class abstract
An abstract class to define lifecycle hooks for dependency injection.
Classes that implement Injectable can be registered with the Injector
and automatically receive onInit
and onDispose
callbacks during their lifecycle.
Example:
class MyService extends Injectable {
@override
void onInit() {
// Called when this service is first registered
}
@override
void onDispose() {
// Called when this service is removed/disposed
}
}
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onDispose(
) → void - Called when the object is removed or cleaned up by the Injector.
-
onInit(
) → void - Called when the object is first registered using Injector.put, Injector.putScoped, Injector.autoDisposePut, or Injector.putTagged.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited