controllerOf static method

GFormController controllerOf(
  1. BuildContext context
)

Like maybeControllerOf but throws a FlutterError when no GForm is found above context. Use this from widgets that require a form.

Implementation

static GFormController controllerOf(BuildContext context) {
  final controller = maybeControllerOf(context);
  if (controller == null) {
    throw FlutterError(
      'No GForm found in context. '
      'Wrap named gmana_form fields with GForm or pass a controller directly.',
    );
  }
  return controller;
}