Country class
Represents a physical country, the least precision level for this library
In JSON format, the instance for Afghanistan
might look like:
{
"id": 1,
"name": "Afghanistan",
"iso3": "AFG",
"iso2": "AF",
"numeric_code": "004",
"phone_code": "93",
"capital": "Kabul",
"currency": "AFN",
"currency_symbol": "؋",
"tld": ".af",
"native": "افغانستان",
"region": "Asia",
"subregion": "Southern Asia",
"timezones": [
// ... all known timezones for this country
],
"translations": {
"kr": "아프가니스탄"
// ... country name in additional languages
},
"latitude": 33.00000000,
"longitude": 65.00000000,
"emoji": "🇦🇫",
"emojiU": "U+1F1E6 U+1F1EB",
"states": [
// ... all known states in this country
]
}
- Inheritance
- Available extensions
- Annotations
-
- @immutable
- @JsonSerializable()
Constructors
-
Country.new({required int id, required String name, required String? capital, required String? currency, required String currencyName, required String currencySymbol, required String? emoji, required String? emojiU, required String? iso2, required String? iso3, required String? native, required String? nationality, required String numericCode, required String phoneCode, required String? region, required List<
Region> states, required String? subregion, required List<Timezone> ? timezones, required String? tld, required Map<String, String> translations, required double longitude, required double latitude}) -
const
-
Country.fromJson(Map<
String, dynamic> json) -
Creates a new Country from JSON.
factory
Properties
- capital → String?
-
The capital of this country, like
Kabul
forAfghanistan
You can find this as a City by like:final - currency → String?
-
The currency abbreviation for this country, like
AFN
forAfghanistan
final - currencyName → String
-
The currency name for this country, like
Czech koruna for
Czech Republic`final - currencySymbol → String
-
The currency symbol for this country, like
؋
forAfghanistan
final - emoji → String?
-
This country's flag as an emoji, like
🇦🇫
forAfghanistan
final - emoji → String?
-
Available on GeoLocationNode, provided by the GeoLocationNodeExtensions extension
The flag emoji for this node. This will walk the nodes to Country for the Country.emoji flag. If the node is a custom node that can't be walked, this returnsnull
.no setter - emojiU → String?
-
This country's flag as emoji unicode characters, like
U+1F1E6 U+1F1EB
forAfghanistan
final - hashCode → int
-
The hash code for this object.
no setterinherited
- id → int
-
The unique identifier for this data, like
1
finalinherited - iso2 → String?
-
The two-digit ISO code for this country, like
AF
forAfghanistan
final - iso3 → String?
-
The three-digit ISO code for this country, like
AFG
forAfghanistan
final - latitude → double
-
The longitude coordinate for this data, like
65.00000000
finalinherited - longitude → double
-
The longitude coordinate for this data, like
33.00000000
finalinherited - name → String
-
The human name of this data, like
Afghanistan
finalinherited - nameQualified → String
-
Available on GeoLocationNode, provided by the GeoLocationNodeExtensions extension
The qualified name (including parent names), separated by,
no setter - nationality → String?
-
This countries nationality, like
Czech
forCzech Republic
final - native → String?
-
This country's name in its native language, like
افغانستان
forAfghanistan
final - numericCode → String
-
This country's three-digit numeric code as defined in ISO 3166-1, like
004
forAfghanistan
final - parentId → int
-
finalinherited
- phoneCode → String
-
The phone number prefix for this country, like
93
forAfghanistan
final -
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setteroverride
- region → String?
-
This country's region, often continent, like
Asia
forAfghanistan
final - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
states
→ List<
Region> -
A List of Region instances, representing states for this country
final
- stringify → bool?
-
If set to
true
, thetoString
method will be overridden to output this instance'sprops
.no setterinherited - subregion → String?
-
This country's subregion, like
Southern Asia
forAfghanistan
final -
timezones
→ List<
Timezone> ? -
A List of Timezone instances, representing the timezones used in this country
final
- tld → String?
-
The top-level-domain for this country, like
.af
forAfghanistan
final -
translations
→ Map<
String, String> -
A map of two-digit ISO language codes, and translated names of this country
final
Methods
-
distanceTo(
T location) → double -
Available on T, provided by the GeoCoordsExtensions extension
-
findClosest(
GeoCoords target) → GeoLocationNode? -
Available on Country, provided by the CountryExtensions extension
Finds the GeoLocationNode (City, Region, or Country) instance closest to the providedtarget
-
findClosestCity(
GeoCoords target) → City? -
Available on Country, provided by the CountryExtensions extension
Finds the City in this Country nearest to thetarget
. -
findClosestRegion(
GeoCoords target) → Region? -
Available on Country, provided by the CountryExtensions extension
Finds the Region in this Country nearest to thetarget
. -
metersTo(
T location) → double -
Available on T, provided by the GeoCoordsExtensions extension
Measures the distance betweenthis
instance and the providedlocation
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
search(
String value) → Iterable< GeoLocationNode> -
Available on Country, provided by the CountryExtensions extension
Finds the GeoLocationNode (City, or Region) with a name containing thevalue
-
stateCodeToName(
{required String code}) → String -
Available on Country, provided by the CountryExtensions extension
Resolves a Region.stateCode to its name -
toJson(
) → Map< String, dynamic> -
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited