StreamNotification<T> class abstract

A class that encapsulates the NotificationKind of event, value of the event in case of onData, or the Error in the case of onError. A container object that wraps the NotificationKind of event (OnData, OnDone, OnError), and the item or error that was emitted. In the case of onDone, no data is emitted as part of the StreamNotification.

Available extensions

Constructors

StreamNotification.data(T value)
Constructs a StreamNotification with NotificationKind.data and wraps a value
factory
StreamNotification.done()
Constructs a StreamNotification with NotificationKind.done.
const
factory
StreamNotification.error(Object error, [StackTrace? stackTrace])
Constructs a StreamNotification with NotificationKind.error and wraps an error and stackTrace
factory

Properties

dataValueOrNull → T?

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

Returns data if kind is NotificationKind.data, otherwise returns null.
no setter
errorAndStackTraceOrNull ErrorAndStackTrace?

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

Returns error and stack trace if kind is NotificationKind.error, otherwise returns null.
no setter
hashCode int
The hash code for this object.
no setterinherited
isData bool

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

A test to determine if this StreamNotification wraps a data event.
no setter
isDone bool

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

A test to determine if this StreamNotification wraps a done event.
no setter
isError bool

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

A test to determine if this StreamNotification wraps an error event.
no setter
kind NotificationKind
References the NotificationKind of this StreamNotification event.
final
requireDataValue → T

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

Returns data if kind is NotificationKind.data, otherwise throws a TypeError error. See also dataValueOrNull.
no setter
requireErrorAndStackTrace ErrorAndStackTrace

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

Returns error and stack trace if kind is NotificationKind.error, otherwise throws a TypeError error.
no setter
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
toString() String
A string representation of this object.
inherited
when<R>({required R data(T value), required R done(), required R error(ErrorAndStackTrace)}) → R

Available on StreamNotification<T>, provided by the StreamNotificationExtensions extension

Invokes the appropriate function on the StreamNotification based on the kind.

Operators

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