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({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 for Afghanistan You can find this as a City by like:
final
currency String?
The currency abbreviation for this country, like AFN for Afghanistan
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 ؋ for Afghanistan
final
emoji String?
This country's flag as an emoji, like 🇦🇫 for Afghanistan
final
emojiU String?
This country's flag as emoji unicode characters, like U+1F1E6 U+1F1EB for Afghanistan
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 for Afghanistan
final
iso3 String?
The three-digit ISO code for this country, like AFG for Afghanistan
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
nationality String?
This countries nationality, like Czech for Czech Republic
final
native String?
This country's name in its native language, like افغانستان for Afghanistan
final
numericCode String
This country's three-digit numeric code as defined in ISO 3166-1, like 004 for Afghanistan
final
parentId int
finalinherited
phoneCode String
The phone number prefix for this country, like 93 for Afghanistan
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 for Afghanistan
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, the toString method will be overridden to output this instance's props.
no setterinherited
subregion String?
This country's subregion, like Southern Asia for Afghanistan
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 for Afghanistan
final
translations Map<String, String>
A map of two-digit ISO language codes, and translated names of this country
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
override
toString() String
A string representation of this object.
inherited

Operators

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