of static method

FormController? of(
  1. BuildContext context, {
  2. bool nullOk = false,
})

Implementation

static FormController? of(BuildContext context, {bool nullOk = false}) {
  final SimpleDynamicForm? result = context.findAncestorWidgetOfExactType<SimpleDynamicForm>();
  if (nullOk || result != null) return result!.controller;
  throw FlutterError.fromParts(<DiagnosticsNode>[
    ErrorSummary(
        'SimpleDynamicForm.of() called with a context that does not contain an SimpleDynamicForm.'),
    ErrorDescription(
        'No SimpleDynamicForm ancestor could be found starting from the context that was passed to SimpleDynamicForm.of().'),
    context.describeElement('The context used was')
  ]);
}