LevitAppLifecycleMixin mixin
A mixin that connects a LevitController to the Flutter application lifecycle.
Automatically registers a WidgetsBindingObserver when the controller is initialized and removes it when closed.
// Example usage:
class MyController extends LevitController with LevitAppLifecycleMixin {
@override
void onAppResumed() {
print('App is back!');
fetchData();
}
}
- Superclass constraints
Properties
-
disposed
→ Future<
void> -
Completes when cleanup reaches its terminal state.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- initialized → bool
-
Whether onInit has been executed.
no setterinherited
- isClosed → bool
-
Whether the controller has been disposed and closed.
no setterinherited
- isClosing → bool
-
Whether owner cleanup has started.
no setterinherited
- isDisposed → bool
-
Whether cleanup has completed.
no setterinherited
- isInitialized → bool
-
Whether the initialization phase is complete.
no setterinherited
-
ownedResources
→ Iterable<
Object> -
Resources currently tracked by this owner.
no setterinherited
- ownerPath → String
-
The full owner path within the monitoring system (scopeId:registrationKey).
no setterinherited
- registrationKey → String?
-
The registration key used to identify this instance in Levit.
no setterinherited
- resourceOwnerPath → String
-
A diagnostic owner path applied to otherwise unnamed reactive resources.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scope → LevitScope?
-
The LevitScope that currently owns this controller.
no setterinherited
Methods
-
autoDispose<
T> (T object) → T -
Registers
objectfor automatic cleanup when the controller closes.inherited -
didAttachToScope(
LevitScope scope, {String? key}) → void -
Attaches this controller to an owning
scopewith an optional registrationkey.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAppDetached(
) → void - Called when the flutter engine is detached from any host views.
-
onAppHidden(
) → void - Called when the application is hidden.
-
onAppInactive(
) → void - Called when the application is in an inactive state and not receiving input.
-
onAppPaused(
) → void - Called when the application is not visible to the user and running in the background.
-
onAppResumed(
) → void - Called when the application is visible and responding to user input.
-
onClose(
) → void -
Called when the controller is removed from memory.
override
-
onInit(
) → void -
Called immediately after the controller is initialized.
override
-
own<
T> (T resource) → T -
Registers
resourcefor deterministic cleanup and returns it.inherited -
refreshOwnedReactivePaths(
) → void -
Reconciles already-owned reactive diagnostics after scope attachment.
inherited
-
runGuardedAsync<
T> (FutureOr< T> action(), {bool cancelOnClose = true, void onError(Object error, StackTrace stackTrace)?}) → Future<T?> -
Executes
actionand suppresses its result if this controller closes first.inherited -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited