SnapState<T> class Null safety

Snap representation of the state

Available Extensions
Annotations

Constructors

SnapState.data([T? data])
const
SnapState.error(dynamic err, [StackTrace? s, VoidCallback? refresher])
factory
SnapState.none()
const
SnapState.waiting()
const

Properties

data → T?
The latest data received by the asynchronous computation. [...]
final
error → dynamic
The latest error object received by the asynchronous computation. [...]
final
hasData bool
Returns whether this snapshot contains a non-null data value.
read-only
hasError bool
Returns whether this snapshot contains a non-null error value.
read-only
hashCode int
The hash code for this object. [...]
read-only, override
isActive bool
final
isDone bool
final
isIdle bool
Where the reactive state is in the initial state [...]
read-only
isWaiting bool
Where the reactive state is in the waiting for an asynchronous task to resolve [...]
read-only
onErrorRefresher → (void Function?()?)
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stackTrace StackTrace?
The latest stack trace object received by the asynchronous computation. [...]
final
state → T
Similar to data with the particularity that it is non nullable.
read-only

Methods

copyTo({bool? isWaiting, bool? isIdle, bool? isActive, T? data, dynamic error, StackTrace? stackTrace}) SnapState<T>
copyToHasData(T? data) SnapState<T>
copyToHasError(dynamic error, {StackTrace? stackTrace, void onErrorRefresher()?, T? data, bool enableNull = false}) SnapState<T>
copyToIsDone() SnapState<T>
copyToIsIdle([T? data]) SnapState<T>
copyToIsWaiting() SnapState<T>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
onAll<R>({R onIdle()?, required R onWaiting()?, required R onError(dynamic error, VoidCallback refreshError)?, required R onData(T data)}) → R
onOrElse<R>({R onIdle()?, R onWaiting()?, R onError(dynamic error, VoidCallback refreshError)?, R onData(T data)?, required R orElse(T data)}) → R
toString() String
A string representation of this object. [...]
override
toStringShort() String
type() Type

Operators

operator ==(Object other) bool
The equality operator. [...]
override