toLatLng method

LatLng toLatLng({
  1. bool reverse = false,
})

Converts the current Location object into a LatLng instance.

The reverse parameter controls the order of latitude and longitude:

  • If false (default): returns LatLng(lat, lng)
  • If true: returns LatLng(lng, lat)

Example:

final location = Location(lat: 37.4219983, lng: -122.084);
final latLng = location.toLatLng(); // LatLng(37.4219983, -122.084)

Implementation

LatLng toLatLng({bool reverse = false}) =>
    reverse ? LatLng(lng ?? 0, lat ?? 0) : LatLng(lat ?? 0, lng ?? 0);