CountryCoder class

An offline geocoder for countries and other big territories.

See also LocationMatcher for matching a location against multiple regions, and WhichPolygon for a general point-in-polygon index.

Properties

hashCode int
The hash code for this object.
no setterinherited
ready bool
Returns true when the data can be used.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

callingCodes({double? lon, double? lat, dynamic query}) List<String>
Returns the full international calling codes for phone numbers in the region matching query, if any.
ccTLD({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the ccTLD (country code top-level domain) for the region matching the arguments, if any.
ccTLDs(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the ccTLD (country code top-level domain) sequences of regions at the location.
drivingSide({double? lon, double? lat, dynamic query}) RegionDrivingSide?
Returns the side traffic drives on in the region matching query.
emojiFlag({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the emoji flag sequence for the region matching the arguments, if any.
emojiFlags(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the emoji flag sequences of regions at the location.
isIn({double? lon, double? lat, dynamic query, dynamic inside}) bool
isInEuropeanUnion({double? lon, double? lat, dynamic query}) bool
Returns true if the region matching query is within EU jurisdiction.
isInUnitedNations({double? lon, double? lat, dynamic query}) bool
Returns true if the region matching query is, or is within, a United Nations member state.
iso1A2Code({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the ISO 3166-1 alpha-2 code for the region matching the arguments, if any.
iso1A2Codes(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the ISO 3166-1 alpha-2 codes of regions at the location.
iso1A3Code({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the ISO 3166-1 alpha-3 code for the region matching the arguments, if any.
iso1A3Codes(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the ISO 3166-1 alpha-3 codes of regions at the location.
iso1N3Code({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the ISO 3166-1 numeric-3 code for the region matching the arguments, if any.
iso1N3Codes(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the ISO 3166-1 numeric-3 codes of regions at the location.
load([List? prepared]) CountryCoder
Synchronously loads the border data and builds trees out of it. This can take up to a second, so in applications try calling prepareData in an non-UI thread first.
m49Code({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the UN M49 code for the region matching the arguments, if any.
m49Codes(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the UN M49 codes of regions at the location.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
region({double? lon, double? lat, dynamic query, RegionLevel? level, RegionLevel? maxLevel, RegionProperties? withProp}) RegionFeature?
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.
regionsContaining({double? lon, double? lat, List<double>? bbox, dynamic query, bool strict = false}) List<RegionFeature>
Returns a list of regions that either contain the given (lon, lat) location, or intersect with a given bbox (which is minLon, minLat, maxLon, maxLat), or contain the region matching the query string / number. The result includes the entire region hierarchy, including the 001 region for the entire world.
regionsIn(dynamic id, [bool strict = false]) List<RegionFeature>
Returns the region matching id and all regions it contains, if any. If passing true for strict, an exact match will not be included.
roadHeightUnit({double? lon, double? lat, dynamic query}) RegionHeightUnit?
Returns the road vehicle height restriction unit for the region matching query.
roadSpeedUnit({double? lon, double? lat, dynamic query}) RegionSpeedUnit?
Returns the road speed unit for the region matching query.
smallestOrMatchingRegion({double? lon, double? lat, dynamic query}) RegionFeature?
Returns the smallest region enclosing a (lon, lat) location, or a region that matches the query string / number.
toString() String
A string representation of this object.
inherited
wikidataQID({double? lat, double? lon, dynamic query, RegionLevel? level, RegionLevel? maxLevel}) String?
Returns the Wikidata QID code for the region matching the arguments, if any.
wikidataQIDs(double? lon, double? lat, List<double>? bbox) List<String>
Returns all the Wikidata QIDs of regions at the location.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance CountryCoder
Returns a singleton instance of CountryCoder. Note that you must initialize it using either load or loadAsync before using. Check for ready property to know when it's loaded.
final

Static Methods

prepareData(dynamic _) List
Loads the border data separately and returns it in a serialized form. Call this from inside the compute() function to process data in a background thread, and then pass the result to load. Like this: