StreamNotificationExtensions<T> extension
Provides extension methods on StreamNotification.
- on
Properties
- dataValueOrNull → T?
-
Returns data if kind is NotificationKind.data,
otherwise returns null.
no setter
- errorAndStackTraceOrNull → ErrorAndStackTrace?
-
Returns error and stack trace if kind is NotificationKind.error,
otherwise returns null.
no setter
- isData → bool
-
A test to determine if this StreamNotification wraps a data event.
no setter
- isDone → bool
-
A test to determine if this StreamNotification wraps a done event.
no setter
- isError → bool
-
A test to determine if this StreamNotification wraps an error event.
no setter
- requireDataValue → T
-
Returns data if kind is NotificationKind.data,
otherwise throws a TypeError error.
See also dataValueOrNull.
no setter
- requireErrorAndStackTrace → ErrorAndStackTrace
-
Returns error and stack trace if kind is NotificationKind.error,
otherwise throws a TypeError error.
no setter
Methods
-
when<
R> ({required R data(T value), required R done(), required R error(ErrorAndStackTrace)}) → R - Invokes the appropriate function on the StreamNotification based on the kind.