StreamCmd<T> class

A command that manages a stream subscription.

Unlike regular Cmd, a StreamCmd continues producing messages until cancelled or the stream completes.

Inheritance
Available extensions

Constructors

StreamCmd({required Stream<T> stream, required Msg? onData(T data), Msg? onError(Object error, StackTrace stack)?, Msg? onDone()?})

Properties

hashCode int
The hash code for this object.
no setterinherited
isActive bool
Whether the subscription is active.
no setter
isActive bool

Available on Cmd?, provided by the CmdExtension extension

Returns true if this command is non-null and not a no-op.
no setter
onData Msg? Function(T data)
Callback for stream data events.
final
onDone Msg? Function()?
Callback for stream completion.
final
onError Msg? Function(Object error, StackTrace stack)?
Callback for stream errors.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
stream Stream<T>
The stream to listen to.
final

Methods

cancel() Future<void>
Cancels the stream subscription.
execute() Future<Msg?>
Executes the command and returns the resulting message (if any).
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orNone() Cmd

Available on Cmd?, provided by the CmdExtension extension

Returns the command or Cmd.none() if null.
start(void sendMessage(Msg)) → void
Starts listening to the stream.
toString() String
A string representation of this object.
inherited

Operators

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