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)
-
DATAis loadeddataState datadataIsValidData validity at the time of emissionconstfactory - LceState.error(DATA? data, bool dataIsValid, Exception error)
-
DATAload error. May contain somedataif cacheddataState datadataIsValidData validity at the time of emissionerrorError occurredconstfactory - LceState.loading(DATA? data, bool dataIsValid, [LoadingType type])
-
DATAis loadingdatais the current data if anydataIsValidData validity at the time of emissiontypeLoading typeconstfactory - LceState.terminated()
-
Creates a terminating state that signals emission finish
constfactory
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
-
catchToLce<
DATA_2 extends Object> (LceState< DATA_2> block(LceState<DATA_1> )) → LceState<DATA_2> -
Available on LceState<
Runs transformationDATA_1> , provided by the LceStateUtils extensionblockcatching any error and wrapping it to LceError: -
combine<
DATA_2 extends Object, DATA_3 extends Object> (LceState< DATA_2> other, DATA_3? mapper(DATA_1? data1, DATA_2? data2)) → LceState<DATA_3> -
Available on LceState<
Combines two Lce states. Here is the result state matrixDATA_1> , provided by the LceStateUtils extension -
map<
DATA_2 extends Object> (DATA_2 mapper(DATA_1)) → LceState< DATA_2> -
Available on LceState<
Maps data in LceState withDATA_1> , provided by the LceStateUtils extensionmapper -
mapEmptyData(
LceState< DATA_1> block(LceState<DATA_1> )) → LceState<DATA_1> -
Available on LceState<
Substitutes a state with empty data with empty data with state produced byDATA_1> , provided by the LceStateUtils extensionblock -
mapEmptyDataItem(
DATA_1 block()) → LceState< DATA_1> -
Available on LceState<
Substitutes an item in a state with empty data with item produced byDATA_1> , provided by the LceStateUtils extensionblock -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toError(
Exception error) → LceError< DATA> -
Transfers to LceError state with
errorpreserving data -
toLoading(
[LoadingType type = LoadingType.loading]) → LceLoading< DATA> -
Transfers to LceLoading state with loading
typepreserving 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
onElsecallback required. Every unset callback will be routed toonElsecase.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited