LceModel<DATA extends Object, PARAMS extends Object> class
abstract
A model interface to load data and transmit it to subscribers along with loading operation state
The model is bound with params that identify the data
DATA Data type of data being loaded
PARAMS Params type that identify data being loaded
- Implemented types
-
- LceUseCase<
DATA>
- LceUseCase<
- Available extensions
Constructors
-
LceModel.cacheThenNet(PARAMS params, ServiceSet<
DATA, PARAMS> serviceSet, {Stream<LceState< ? startWith, Logger? logger})DATA> > -
Creates a model that takes a cached value and then reloads from network if
nothing cached or cached data is stalled
paramsParams that identify data being loadedserviceSetData service-setstartWithStream that emits before loading start.loggerLogging functionconstfactory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- params → PARAMS
-
Params that identify data being loaded
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
state
→ Stream<
LceState< DATA> > -
Model state. Subscription starts data load for the first subscriber.
Whenever last subscriber cancels, the model unsubscribes internal components for data updates
no setterinherited
Methods
-
map<
DATA_2 extends Object> (DATA_2 mapper(DATA data)) → LceModel< DATA_2, PARAMS> -
Available on LceModel<
Creates a model wrapper that convertsDATA, PARAMS> , provided by the LceModelExtension extensionDATA_1toDATA_2DATA_2Resulting data typemapperData mapper -
map<
DATA_2 extends Object> (DATA_2 mapper(DATA data)) → LceUseCase< DATA_2> -
Available on LceUseCase<
Creates a use-case wrapper that convertsDATA> , provided by the LceUseCaseExtension extensionDATA_1toDATA_2DATA_2Resulting data typemapperData mapper -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
refresh(
) → Future< void> -
Requests a refresh of data.
Data will be updated asynchronously
inherited
-
refreshed(
) → LceUseCase< DATA> -
Available on LceUseCase<
Wraps use-case to refresh on each subscriptionDATA> , provided by the LceUseCaseExtension extension -
toString(
) → String -
A string representation of this object.
inherited
-
withRefresh(
Stream refresh) → Stream< LceState< DATA> > -
Available on LceUseCase<
Takes the LceUseCase.state of model that is being refreshed each timeDATA> , provided by the LceUseCaseExtension extensionrefreshemits a value Useful when you create a model as a result of mapping of some input (params for example) and the LceUseCase.refresh property becomes invisible for the outside worldDATASource model data typerefreshWhenever this stream emits a value, the model is refreshed
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited