region method
RegionFeature?
region({
- double? lon,
- double? lat,
- dynamic query,
- RegionLevel? level,
- RegionLevel? maxLevel,
- 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.');
}
}