-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlce_model.dart
30 lines (26 loc) · 1.12 KB
/
lce_model.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import 'package:dartlcemodel/dartlcemodel_lce.dart';
import 'package:dartlcemodel/dartlcemodel_model.dart';
import 'package:dartlcemodel/dartlcemodel_utils.dart';
import './cache_then_net_lce_model.dart';
/// 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
abstract class LceModel<DATA extends Object, PARAMS extends Object> implements LceUseCase<DATA> {
/// Params that identify data being loaded
PARAMS get params;
/// 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 LceModel.cacheThenNet(
PARAMS params,
ServiceSet<DATA, PARAMS> serviceSet,
{
Stream<LceState<DATA>>? startWith,
Logger? logger
}
) = CacheThenNetLceModel;
}