of<T> static method

CustomGroupController of<T>(
  1. BuildContext context, {
  2. bool nullOk = false,
})

Implementation

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