ValueStreamExtensions<T> extension Null safety

Extensions to easily access value and error.

on

Properties

error Object?
Last emitted error, or null if no error added or value exists.
read-only
hasError bool
A flag that turns true as soon as at an error event has been emitted.
read-only
hasValue bool
A flag that turns true as soon as at least one event has been emitted.
read-only
requireError Object
Returns last emitted error, failing if there is no error. Throws StateError if no error added or value exists.
read-only
requireValue → T
Returns last emitted value, failing if there is no value. Throws error if hasError. Throws StateError, if neither hasData nor hasError.
read-only
value → T?
Returns last emitted value, or null if there has been no emission yet.
read-only