LateInit mixin
A mixin that delays a piece of initialization logic until the main ControlFactory is fully initialized.
This is useful for Initializable objects that depend on services that are registered
asynchronously during Control.initControl.
When an object with this mixin is initialized via its init method, it waits for Control.factory.onReady()
to complete and then calls the onLateInit() method.
Example:
class MyService with Initializable, LateInit {
late final ApiService _api;
@override
void onLateInit() {
// This code runs after the factory is fully ready.
_api = Control.get<ApiService>();
print('ApiService is now available!');
}
}
- Superclass constraints
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isInitReady → bool
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
init(
Map args) → void -
Initializes the object with a map of arguments.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onLateInit(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited