maybeOf static method

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

Implementation

static MapState? maybeOf(BuildContext context, {bool nullOk = false}) {
  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.');
}