Notification<T> class
Null safety
A class that encapsulates the Kind of event, value of the event in case of onData, or the Error in the case of onError. A container object that wraps the Kind 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 Notification.
Constructors
-
Notification(Kind kind, ValueWrapper<
T> ? _value, ErrorAndStackTrace? errorAndStackTrace) -
Constructs a Notification which, depending on the
kind
, wraps eithervalue
, orerrorAndStackTrace
, or neither if it is just a Kind.OnData event.const - Notification.onData(T value)
-
Constructs a Notification with Kind.OnData and wraps a
value
factory - Notification.onDone()
-
Constructs a Notification with Kind.OnDone
factory
- Notification.onError(Object error, StackTrace? stackTrace)
-
Constructs a Notification with Kind.OnError and wraps an
error
andstackTrace
factory
Properties
- errorAndStackTrace → ErrorAndStackTrace?
-
The wrapped error and stack trace, if applicable
final
- hashCode → int
-
The hash code for this object. [...]
read-only, override
- isOnData → bool
-
A test to determine if this Notification wraps an onData event
read-only
- isOnDone → bool
-
A test to determine if this Notification wraps an onDone event
read-only
- isOnError → bool
-
A test to determine if this Notification wraps an error event
read-only
- kind → Kind
-
References the Kind of this Notification event.
final
- requireData → T
-
Returns data if kind is Kind.OnData, otherwise throws
"Null check operator used on a null value"
error.read-only - runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
A string representation of this object. [...]
override
Operators
-
operator ==(
Object other) → bool -
The equality operator. [...]
override