getCurrentLocation static method

Future<LatLong?> getCurrentLocation()

Implementation

static Future<LatLong?> getCurrentLocation() async {
  final Map<String, int>? currentLocation = await _locationMethodChannel
      .invokeMapMethod<String, int>("getCurrentLocation");

  final latitude = currentLocation?["latitude"];
  final longitude = currentLocation?["longitude"];

  if (latitude != null && longitude != null) {
    return LatLong(latitude: latitude, longitude: longitude);
  } else {
    return null;
  }
}