ZenithPeriodicService class

A background service that runs a periodic task every interval duration.

Automatically creates a Timer.periodic on start and cancels it when the container scope disposes or resets.

Inheritance

Constructors

ZenithPeriodicService({required Duration interval, required Future<void> task(ZenithRef ref)})
Creates a ZenithPeriodicService.

Properties

hashCode → int
The hash code for this object.
no setterinherited
interval → Duration
The time interval between periodic task executions.
final
lastError ↔ Object?
Most recent periodic task error. Task failures do not escape the timer.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
task → Future<void> Function(ZenithRef ref)
The async task callback executed on every tick.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onStart(ZenithRef ref) → Future<void>
Called when this service is registered with a ZenithRef.
override
onStop() → Future<void>
Called when the owning ZenithContainer or ZenithRef scope is disposed/reset.
override
toString() → String
A string representation of this object.
inherited

Operators

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