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
Available extensions

Constructors

LceModel.cacheThenNet(PARAMS params, ServiceSet<DATA, PARAMS> serviceSet, {Stream<LceState<DATA>>? startWith, Logger? logger})
Creates a model that takes a cached value and then reloads from network if nothing cached or cached data is stalled params Params that identify data being loaded serviceSet Data service-set startWith Stream that emits before loading start. logger Logging function
const
factory

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<DATA, PARAMS>, provided by the LceModelExtension extension

Creates a model wrapper that converts DATA_1 to DATA_2 DATA_2 Resulting data type mapper Data mapper
map<DATA_2 extends Object>(DATA_2 mapper(DATA data)) LceUseCase<DATA_2>

Available on LceUseCase<DATA>, provided by the LceUseCaseExtension extension

Creates a use-case wrapper that converts DATA_1 to DATA_2 DATA_2 Resulting data type mapper Data 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<DATA>, provided by the LceUseCaseExtension extension

Wraps use-case to refresh on each subscription
toString() String
A string representation of this object.
inherited
withRefresh(Stream refresh) Stream<LceState<DATA>>

Available on LceUseCase<DATA>, provided by the LceUseCaseExtension extension

Takes the LceUseCase.state of model that is being refreshed each time refresh emits 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 world DATA Source model data type refresh Whenever this stream emits a value, the model is refreshed

Operators

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