load<TSearchModel> method
Future<void>
load<
TSearchModel>([ - TSearchModel? searchModel
])
Implementation
Future<void> load<TSearchModel>([TSearchModel? searchModel]) async {
final previousState = state.copyWith();
if (state is AbstractItemFilterableState) {
(state as AbstractItemFilterableState).searchModel =
searchModel ?? (state as AbstractItemFilterableState).searchModel;
}
await onBeforeLoad(searchModel);
state.resultStatus = ResultStatus.loading;
updateState(state.copyWith() as S);
try {
updateState(convertResultToState(await resolveData()));
} catch (e) {
await for (final result in resolveStreamData()) {
updateState(convertResultToState(result));
}
}
await onAfterLoad(searchModel, previousState);
}