toLatLng method
Converts the current Location object into a LatLng instance.
The reverse parameter controls the order of latitude and longitude:
- If
false(default): returnsLatLng(lat, lng) - If
true: returnsLatLng(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);