of static method

GeolocationStatus of(
  1. BuildContext context, {
  2. bool listen = true,
})

Get the current geolocation status.

Implementation

static GeolocationStatus of(BuildContext context, {bool listen = true}) {
  final inherited = (listen
      ? context.dependOnInheritedWidgetOfExactType<_InheritedGeolocation>()
      : context
          .getElementForInheritedWidgetOfExactType<_InheritedGeolocation>()
          ?.widget) as _InheritedGeolocation?;

  if (inherited == null) {
    throw Exception('No Geolocation found in widget tree');
  }

  return inherited.status;
}