onLoadPageAction method

  1. @protected
void onLoadPageAction(
  1. LoadPageActionEvent event,
  2. Emitter<BaseState> emit
)

Implementation

@protected
void onLoadPageAction(
    LoadPageActionEvent event, Emitter<BaseState> emit) async {
  PageLoadedState state;
  final func = Lowder.actions.getPageLoadResolver(event.action.type);
  if (func == null) {
    log.severe("Unknown LoadPageAction type: '${event.action.type}'");
    state = PageLoadedState(event.page, event.fullData, false);
  } else {
    state = await func(event);
    log.infoWithContext(
        "LoadPageAction '${event.action.type}' executed successfully", {
      "page": event.page,
      "pageSize": event.pageSize,
      "hasMore": state.hasMore,
      "length": state.fullData.length,
      "last": state.fullData.lastOrNull,
    });
  }
  emit(state);
}