builder method

Widget builder(
  1. BuildContext context,
  2. BaseState currentState
)

Implementation

Widget builder(BuildContext context, BaseState currentState) {
  widget.log.infoWithContext(
    "Building '$name' from state ${currentState.runtimeType}.",
    Lowder.properties.getEvaluatorContext(null, state, null),
  );

  if (currentState is ReloadState || currentState is ReloadAll) {
    _initialized = false;
  } else if (currentState is SetStateState) {
    state.addAll(currentState.state);
  }

  if (!_initialized) {
    _initialized = true;
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      widget.initState(context);
    });
  }

  return Form(
    key: widget.formKey,
    autovalidateMode: AutovalidateMode.disabled,
    child: buildSpecBody(context, bodySpec),
  );
}