fromCoords static method

Geolocation? fromCoords(
  1. String coords, [
  2. bool? onlyWithCardinals
])

Implementation

static Geolocation? fromCoords(String coords, [bool? onlyWithCardinals]) {
  coords = coords.trim();

  var parts = coords.split(RegExp(r'\s+'));
  if (parts.length < 2) return null;

  var lat = parseLatitudeOrLongitudeValue(parts[0], onlyWithCardinals!);
  var long = parseLatitudeOrLongitudeValue(parts[1], onlyWithCardinals);

  return lat != null && long != null ? Geolocation(lat, long) : null;
}