LceState<DATA extends Object> class abstract

State for 'Loading-Content-Error' resource which retrieves DATA

Implementers
Available extensions

Constructors

LceState.content(DATA data, bool dataIsValid)
DATA is loaded data State data dataIsValid Data validity at the time of emission
const
factory
LceState.error(DATA? data, bool dataIsValid, Exception error)
DATA load error. May contain some data if cached data State data dataIsValid Data validity at the time of emission error Error occurred
const
factory
LceState.loading(DATA? data, bool dataIsValid, [LoadingType type])
DATA is loading data is the current data if any dataIsValid Data validity at the time of emission type Loading type
const
factory
LceState.terminated()
Creates a terminating state that signals emission finish
const
factory

Properties

data → DATA?
State data
final
dataIsValid bool
A property that is evaluated internally and may mean that data being emitted is stall, invalidated or otherwise 'not-so-valid' until some further emission (say after network reload).
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toError(Exception error) LceError<DATA>
Transfers to LceError state with error preserving data
toLoading([LoadingType type = LoadingType.loading]) LceLoading<DATA>
Transfers to LceLoading state with loading type preserving data
toString() String
A string representation of this object.
inherited
when<T extends Object>({required T loading(LceLoading<DATA> state), required T content(LceContent<DATA> state), required T error(LceError<DATA> state), T terminated()?}) → T
Emulates sealed class with every state callback required except terminated. Override it if you expect termination or leave empty to throw exception
whenElse<T extends Object>({T loading(LceLoading<DATA> state)?, T content(LceContent<DATA> state)?, T error(LceError<DATA> state)?, T terminated()?, required T onElse(LceState<DATA> state)}) → T
Emulates sealed class with only one onElse callback required. Every unset callback will be routed to onElse case.

Operators

operator ==(Object other) bool
The equality operator.
inherited