of static method

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

Implementation

static MapState? of(BuildContext context, {bool nullOk = false}) {
  // ignore: unnecessary_null_comparison
  assert(context != null);
  // ignore: unnecessary_null_comparison
  assert(nullOk != null);
  final widget =
      context.dependOnInheritedWidgetOfExactType<MapStateInheritedWidget>();
  if (nullOk || widget != null) {
    return widget?.mapState;
  }
  throw FlutterError(
      'MapState.of() called with a context that does not contain a FlutterMap.');
}