ZenithService class abstract

Abstract contract for background hosted services bound to container scope lifecycles.

Equivalent to IHostedService / BackgroundService in ASP.NET Core.

Implement onStart to perform background initialization (e.g., establishing WebSockets, starting polling timers, subscribing to event streams) and onStop to perform cleanup when the container scope is reset or disposed.

class MyBackgroundSyncService extends ZenithService {
  @override
  Future<void> onStart(ZenithRef ref) async {
    // Start background task
  }

  @override
  Future<void> onStop() async {
    // Teardown
  }
}
Implementers

Constructors

ZenithService()

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
onStart(ZenithRef ref) → Future<void>
Called when this service is registered with a ZenithRef.
onStop() → Future<void>
Called when the owning ZenithContainer or ZenithRef scope is disposed/reset.
toString() → String
A string representation of this object.
inherited

Operators

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