getMyCurrentLocation static method

Future<FormattedLocation> getMyCurrentLocation(
  1. BuildContext context
)

Implementation

static Future<FormattedLocation> getMyCurrentLocation(
    BuildContext context) async {
  var getCurrentLocation = OpenMapSettings.of(context)?.getCurrentLocation;
  if (getCurrentLocation == null) {
    throw FlutterError('You should add getCurrentLocation in map config');
  }
  var settings = OpenMapSettings.of(context);
  Locale locale = Localizations.localeOf(context);
  var latlng = await getCurrentLocation();
  if (latlng == null) {
    throw FlutterError('Can not detect your current location');
  }

  var zoom = settings?.reverseZoom;
  return await Reverse.reverseLocation(
    locale: locale,
    location: latlng,
    zoom: zoom,
  );
}