LevitTimeMixin mixin

A mixin for LevitController that centralizes time-based operations like debouncing, throttling, intervals, and countdowns.

This unified mixin replaces separate debounce/periodic implementations to ensure consistent lifecycle management and memory safety.

Superclass constraints

Properties

hashCode int
The hash code for this object.
no setterinherited
initialized bool
Whether onInit has been executed.
no setterinherited
isClosed bool
Whether the controller is in the process of closing or is closed.
no setterinherited
isDisposed bool
Whether the controller has been disposed and closed.
no setterinherited
isInitialized bool
Whether the initialization phase is complete.
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
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 an object to be automatically cleaned up when this controller is closed.
inherited
cancelAllTimers() → void
Cancels all active timers (debounce, throttle, interval).
cancelTimer(String id) → void
Cancels a specific timer by id.
debounce(String id, Duration duration, void callback()) → void
Debounces a callback function.
didAttachToScope(LevitScope scope, {String? key}) → void
Invoked when the instance is successfully attached to its owning LevitScope.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onClose() → void
Callback invoked when the controller is being removed from Levit.
override
onInit() → void
Callback invoked after the controller is instantiated and registered.
inherited
startCountdown({required Duration duration, Duration interval = const Duration(seconds: 1), void onTick(Duration remaining)?, void onFinish()?}) LxCountdown
Starts a reactive countdown.
startInterval(String id, Duration duration, void callback(Timer timer)) → void
Starts a periodic interval timer.
throttle(String id, Duration duration, void callback()) → void
Throttles a callback function.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited