region method

RegionFeature? region({
  1. double? lon,
  2. double? lat,
  3. dynamic query,
  4. RegionLevel? level,
  5. RegionLevel? maxLevel,
  6. RegionProperties? withProp,
})

Returns the region matching the given query string / number, or the one containing the (lon, lat) location and matching the level, maxLevel, and withProp filters. Default level is country.

Implementation

RegionFeature? region(
    {double? lon,
    double? lat,
    dynamic query,
    RegionLevel? level,
    RegionLevel? maxLevel,
    RegionProperties? withProp}) {
  _checkReady();
  if (lat != null && lon != null) {
    return _borders!.regionForLoc(lon, lat,
        level: level, maxLevel: maxLevel, withProp: withProp);
  } else if (query != null) {
    return _borders!.regionForID(query);
  } else {
    throw ArgumentError('Please specify either location or query.');
  }
}