findClosest method

GeoLocationNode? findClosest(
  1. GeoCoords target
)

Finds the GeoLocationNode (City, Region, or Country) instance closest to the provided target

Returns: A City when possible, otherwise a Region or a Country, whichever is more specific.

Implementation

GeoLocationNode? findClosest(GeoCoords target) {
  final country = countries.findClosestTo(target);
  if (country == null) return null;

  return country.findClosest(target);
}