of<T> static method

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

Implementation

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