StreamService<TData extends Object?, TParams extends Object?> class
abstract
A base class for services that handle streaming data and require disposal.
This class is intended to be used within a Dependency Injection DI system.
It provides a standardized way to manage a stream and its lifecycle, ensuring that resources are properly cleaned up when the service is disposed.
Constructors
Properties
- disposed → bool
-
Whether the service has been disposed.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
initialData
→ FutureOr<
TData> ? -
Completes with the initial data pushed to the stream.
no setter
- initialized → bool
-
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
stream
→ Stream<
TData> ? -
Provides access to the stream managed by this service.
no setter
Methods
-
dispose(
) → FutureOr< void> -
Disposes of this service, making it unusable and ready for garbage
collection.
inherited
-
init(
TParams params) → FutureOr< void> -
Initializes and re-initializes this service, making it ready for use.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onError(
Object e, FutureOr< void> dispose()) → void -
Override this method to handle any errors that occur within the stream.
The
dispose
callback allows for immediate cleanup if necessary. -
provideDisposeListeners(
) → ServiceListeners< void> -
override
-
provideInitListeners(
) → ServiceListeners< TParams> -
override
-
provideInputStream(
TParams params) → Stream< TData> - Override this method to provide the input stream that this service will listen to.
-
provideOnPushToStreamListeners(
) → ServiceListeners< TData> -
pushToStream(
TData data) → void - Pushes data into the internal stream and triggers.
-
restartService(
TParams params) → FutureOr< void> -
inherited
-
shouldAdd(
TData data) → bool - Override this method to define the conditions under which a data item should be added.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited