load method
Implementation
Future<void> load(AbstractItemLoadEvent event, Emitter<S> emit) async {
final previousState = state.copyWith();
if (state is AbstractItemFilterableState) {
(state as AbstractItemFilterableState).searchModel = event.searchModel ??
(state as AbstractItemFilterableState).searchModel;
}
await onBeforeLoad(event, emit);
state.resultStatus = ResultStatus.loading;
updateState(state.copyWith() as S, emit);
try {
updateState(convertResultToState(await resolveData()), emit);
} catch (e) {
await emit.forEach<Result>(
resolveStreamData(),
onData: (result) => convertResultToState(result),
);
}
await onAfterLoad(event, emit, previousState);
}