AsyncSnapshot< T> class
Immutable representation of the most recent interaction with an asynchronous computation.
See also:
- StreamBuilder, which builds itself based on a snapshot from interacting with a Stream.
- FutureBuilder, which builds itself based on a snapshot from interacting with a Future.
- Annotations
- @immutable
Constructors
- AsyncSnapshot.nothing()
-
Creates an AsyncSnapshot in ConnectionState.none with null data and error.
const
- AsyncSnapshot.withData(ConnectionState state, T data)
-
Creates an AsyncSnapshot in the specified
state
and with the specifieddata
.const - AsyncSnapshot.withError(ConnectionState state, Object error)
-
Creates an AsyncSnapshot in the specified
state
and with the specifiederror
.const
Properties
- connectionState → ConnectionState
-
Current state of connection to the asynchronous computation.
final
- data → T
-
The latest data received by the asynchronous computation. [...]
final
- error → Object
-
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
- requireData → T
-
Returns latest data received, failing if there is no data. [...]
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
inState(
ConnectionState state) → AsyncSnapshot< T> -
Returns a snapshot like this one, but in the specified
state
. [...] -
toString(
) → String -
Returns a string representation of this object.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
override