executePageLoadAction method

void executePageLoadAction(
  1. BuildContext buildContext,
  2. ListBloc bloc,
  3. int page,
  4. int pageSize,
  5. List fullData,
  6. Map? actionSpec,
  7. Map state,
  8. Map? actionContext, {
  9. dynamic value,
})

Executes a PageLoadFunction

Implementation

void executePageLoadAction(
    BuildContext buildContext,
    ListBloc bloc,
    int page,
    int pageSize,
    List fullData,
    Map? actionSpec,
    Map state,
    Map? actionContext,
    {dynamic value}) {
  if (actionSpec == null) {
    return;
  }

  NodeSpec action = NodeSpec.fromMap(actionSpec);
  final props = action.props;
  final actionCtx = <dynamic, dynamic>{
    "page": page,
    "pageSize": pageSize,
  }..addAll(actionContext ?? {});

  final evaluatorContext = getEvaluatorContext(value, state, actionCtx);
  properties.evaluateMap(props, evaluatorContext);

  if (props["executeCondition"] != null &&
      !properties.evaluateCondition(props["executeCondition"])) {
    return;
  }

  final context =
      ActionContext(state, actionContext ?? {}, value, buildContext);
  final event =
      LoadPageActionEvent(action, context, page, pageSize, fullData);
  bloc.add(event);
}