getState method

BlocxFormWidgetState<BlocxFormWidget<P>, F, P, E> getState(
  1. BuildContext context
)

Retrieves the nearest ancestor BlocxFormWidgetState.

Used internally to call submit when onPressed is null.

Implementation

BlocxFormWidgetState<BlocxFormWidget<P>, F, P, E> getState(BuildContext context) {
  final state = context.findAncestorStateOfType<BlocxFormWidgetState<BlocxFormWidget<P>, F, P, E>>();

  if (state == null) {
    throw FlutterError(
      'BlocxFormRegisterButton could not find a matching '
      'BlocxFormWidgetState<BlocxFormWidget<$P>, $F, $P, $E> ancestor.',
    );
  }

  return state;
}