CountryCode class
Constructors
- CountryCode.user({String? alpha2, String? alpha3, int? numeric})
-
Creates user-defined country code.
Note: Code is not registered in class
values
, useassign
to register user country codes.factory
Properties
- alpha2 → String
-
Alpha-2 code as defined in (ISO 3166-1)
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
Returns empty string for user-assigned values that doesn't have alpha-2 codeno setter - alpha3 → String
-
Alpha-3 code as defined in (ISO 3166-1)
https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3
Returns empty string for user-assigned values that doesn't have alpha-3 codeno setter - hashCode → int
-
The hash code for this object.
no setteroverride
- index → int
-
Returns position of the value in list of all country codes.
no setter
- isOfficial → bool
-
Returns
true
if the code is official ISO-assignedno setter - isUserAssigned → bool
-
Returns
true
if the code is user-assigned. See (User-assigned code elements)https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#User-assigned_code_elements
no setter - numeric → int
-
Numeric code as defined in (ISO 3166-1)
https://en.wikipedia.org/wiki/ISO_3166-1_numeric
Returns 0 for user-assigned values that doesn't have alpha-3 codeno setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- symbol → String
-
Returns unicode symbol for country code
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
Returns string representation of
CountryCode
. Which isCountryCode.
followed by either alpha-2, alpha-2, or numeric code depeding on which code is defined. For ISO-assigned country codes it alwais returnsCountryCode.
+ alpha-2.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override
Static Properties
-
userValues
→ List<
CountryCode> -
List of all user-assigned country codes
no setter
-
values
→ List<
CountryCode> -
List of all ISO-assigned country codes
no setter
Static Methods
-
assign(
{String? alpha2, String? alpha3, int? numeric}) → int - Assigns user-defined codes. Returns index of country value in userValues Codes could be any combination of Alpha-2, alpha-2, or numeric code. Either one of 3 codes is required. After calling assign user-assigned codes are available through parse, tryParse, ofAlpha, and ofNumeric static methods.
-
ofAlpha(
String code) → CountryCode -
Returns country by Alpha-2 or Alpha-3 code
Throws
ArgumentError
if thecode
is invalid or there is no ISO- or user-assigned country for thiscode
-
ofNumeric(
int code) → CountryCode -
Returns country code by numeric code
Throws
ArgumentError
if the numericcode
is invalid or there is no ISO- or user-assigned country for thiscode
-
parse(
String source) → CountryCode -
Parses
source
as Alpha-2, alpha-3 or numeric country code Thesource
must be either 2-3 ASCII uppercase letters of alpha code, or 2-3 digits of numeric code ThrowsFormatException
if the code is not valid country code -
tryParse(
String source) → CountryCode? -
Parses
source
as Alpha-2, alpha-3 or numeric country code. Same as parse but returnsnull
in case of invalid country code -
unassignAll(
) → void - Removes all of user-assigned codes
Constants
- AD → const CountryCode
- Andorra AD AND 20
- AE → const CountryCode
- United Arab Emirates AE ARE 784
- AF → const CountryCode
- Afghanistan AF AFG 4
- AG → const CountryCode
- Antigua and Barbuda AG ATG 28
- AI → const CountryCode
- Anguilla AI AIA 660
- AL → const CountryCode
- Albania AL ALB 8
- AM → const CountryCode
- Armenia AM ARM 51
- AO → const CountryCode
- Angola AO AGO 24
- AQ → const CountryCode
- Antarctica AQ ATA 10
- AR → const CountryCode
- Argentina AR ARG 32
- AS → const CountryCode
- American Samoa AS ASM 16
- AT → const CountryCode
- Austria AT AUT 40
- AU → const CountryCode
- Australia AU AUS 36
- AW → const CountryCode
- Aruba AW ABW 533
- AX → const CountryCode
- Åland Islands AX ALA 248
- AZ → const CountryCode
- Azerbaijan AZ AZE 31
- BA → const CountryCode
- Bosnia and Herzegovina BA BIH 70
- BB → const CountryCode
- Barbados BB BRB 52
- BD → const CountryCode
- Bangladesh BD BGD 50
- BE → const CountryCode
- Belgium BE BEL 56
- BF → const CountryCode
- Burkina Faso BF BFA 854
- BG → const CountryCode
- Bulgaria BG BGR 100
- BH → const CountryCode
- Bahrain BH BHR 48
- BI → const CountryCode
- Burundi BI BDI 108
- BJ → const CountryCode
- Benin BJ BEN 204
- BL → const CountryCode
- Saint Barthélemy BL BLM 652
- BM → const CountryCode
- Bermuda BM BMU 60
- BN → const CountryCode
- Brunei Darussalam BN BRN 96
- BO → const CountryCode
- Bolivia (Plurinational State of) BO BOL 68
- BQ → const CountryCode
- Bonaire, Sint Eustatius and Saba BQ BES 535
- BR → const CountryCode
- Brazil BR BRA 76
- BS → const CountryCode
- Bahamas BS BHS 44
- BT → const CountryCode
- Bhutan BT BTN 64
- BV → const CountryCode
- Bouvet Island BV BVT 74
- BW → const CountryCode
- Botswana BW BWA 72
- BY → const CountryCode
- Belarus BY BLR 112
- BZ → const CountryCode
- Belize BZ BLZ 84
- CA → const CountryCode
- Canada CA CAN 124
- CC → const CountryCode
- Cocos (Keeling) Islands CC CCK 166
- CD → const CountryCode
- Congo, Democratic Republic of the CD COD 180
- CF → const CountryCode
- Central African Republic CF CAF 140
- CG → const CountryCode
- Congo CG COG 178
- CH → const CountryCode
- Switzerland CH CHE 756
- CI → const CountryCode
- Côte d'Ivoire CI CIV 384
- CK → const CountryCode
- Cook Islands CK COK 184
- CL → const CountryCode
- Chile CL CHL 152
- CM → const CountryCode
- Cameroon CM CMR 120
- CN → const CountryCode
- China CN CHN 156
- CO → const CountryCode
- Colombia CO COL 170
- CR → const CountryCode
- Costa Rica CR CRI 188
- CU → const CountryCode
- Cuba CU CUB 192
- CV → const CountryCode
- Cabo Verde CV CPV 132
- CW → const CountryCode
- Curaçao CW CUW 531
- CX → const CountryCode
- Christmas Island CX CXR 162
- CY → const CountryCode
- Cyprus CY CYP 196
- CZ → const CountryCode
- Czechia CZ CZE 203
- DE → const CountryCode
- Germany DE DEU 276
- DJ → const CountryCode
- Djibouti DJ DJI 262
- DK → const CountryCode
- Denmark DK DNK 208
- DM → const CountryCode
- Dominica DM DMA 212
- DO → const CountryCode
- Dominican Republic DO DOM 214
- DZ → const CountryCode
- Algeria DZ DZA 12
- EC → const CountryCode
- Ecuador EC ECU 218
- EE → const CountryCode
- Estonia EE EST 233
- EG → const CountryCode
- Egypt EG EGY 818
- EH → const CountryCode
- Western Sahara EH ESH 732
- ER → const CountryCode
- Eritrea ER ERI 232
- ES → const CountryCode
- Spain ES ESP 724
- ET → const CountryCode
- Ethiopia ET ETH 231
- FI → const CountryCode
- Finland FI FIN 246
- FJ → const CountryCode
- Fiji FJ FJI 242
- FK → const CountryCode
- Falkland Islands (Malvinas) FK FLK 238
- FM → const CountryCode
- Micronesia (Federated States of) FM FSM 583
- FO → const CountryCode
- Faroe Islands FO FRO 234
- FR → const CountryCode
- France FR FRA 250
- GA → const CountryCode
- Gabon GA GAB 266
- GB → const CountryCode
- United Kingdom of Great Britain and Northern Ireland GB GBR 826
- GD → const CountryCode
- Grenada GD GRD 308
- GE → const CountryCode
- Georgia GE GEO 268
- GF → const CountryCode
- French Guiana GF GUF 254
- GG → const CountryCode
- Guernsey GG GGY 831
- GH → const CountryCode
- Ghana GH GHA 288
- GI → const CountryCode
- Gibraltar GI GIB 292
- GL → const CountryCode
- Greenland GL GRL 304
- GM → const CountryCode
- Gambia GM GMB 270
- GN → const CountryCode
- Guinea GN GIN 324
- GP → const CountryCode
- Guadeloupe GP GLP 312
- GQ → const CountryCode
- Equatorial Guinea GQ GNQ 226
- GR → const CountryCode
- Greece GR GRC 300
- GS → const CountryCode
- South Georgia and the South Sandwich Islands GS SGS 239
- GT → const CountryCode
- Guatemala GT GTM 320
- GU → const CountryCode
- Guam GU GUM 316
- GW → const CountryCode
- Guinea-Bissau GW GNB 624
- GY → const CountryCode
- Guyana GY GUY 328
- HK → const CountryCode
- Hong Kong HK HKG 344
- HM → const CountryCode
- Heard Island and McDonald Islands HM HMD 334
- HN → const CountryCode
- Honduras HN HND 340
- HR → const CountryCode
- Croatia HR HRV 191
- HT → const CountryCode
- Haiti HT HTI 332
- HU → const CountryCode
- Hungary HU HUN 348
- ID → const CountryCode
- Indonesia ID IDN 360
- IE → const CountryCode
- Ireland IE IRL 372
- IL → const CountryCode
- Israel IL ISR 376
- IM → const CountryCode
- Isle of Man IM IMN 833
- IN → const CountryCode
- India IN IND 356
- IO → const CountryCode
- British Indian Ocean Territory IO IOT 86
- IQ → const CountryCode
- Iraq IQ IRQ 368
- IR → const CountryCode
- Iran (Islamic Republic of) IR IRN 364
- IS → const CountryCode
- Iceland IS ISL 352
- IT → const CountryCode
- Italy IT ITA 380
- JE → const CountryCode
- Jersey JE JEY 832
- JM → const CountryCode
- Jamaica JM JAM 388
- JO → const CountryCode
- Jordan JO JOR 400
- JP → const CountryCode
- Japan JP JPN 392
- KE → const CountryCode
- Kenya KE KEN 404
- KG → const CountryCode
- Kyrgyzstan KG KGZ 417
- KH → const CountryCode
- Cambodia KH KHM 116
- KI → const CountryCode
- Kiribati KI KIR 296
- KM → const CountryCode
- Comoros KM COM 174
- KN → const CountryCode
- Saint Kitts and Nevis KN KNA 659
- KP → const CountryCode
- Korea (Democratic People's Republic of) KP PRK 408
- KR → const CountryCode
- Korea, Republic of KR KOR 410
- KW → const CountryCode
- Kuwait KW KWT 414
- KY → const CountryCode
- Cayman Islands KY CYM 136
- KZ → const CountryCode
- Kazakhstan KZ KAZ 398
- LA → const CountryCode
- Lao People's Democratic Republic LA LAO 418
- LB → const CountryCode
- Lebanon LB LBN 422
- LC → const CountryCode
- Saint Lucia LC LCA 662
- LI → const CountryCode
- Liechtenstein LI LIE 438
- LK → const CountryCode
- Sri Lanka LK LKA 144
- LR → const CountryCode
- Liberia LR LBR 430
- LS → const CountryCode
- Lesotho LS LSO 426
- LT → const CountryCode
- Lithuania LT LTU 440
- LU → const CountryCode
- Luxembourg LU LUX 442
- LV → const CountryCode
- Latvia LV LVA 428
- LY → const CountryCode
- Libya LY LBY 434
- MA → const CountryCode
- Morocco MA MAR 504
- MC → const CountryCode
- Monaco MC MCO 492
- MD → const CountryCode
- Moldova, Republic of MD MDA 498
- ME → const CountryCode
- Montenegro ME MNE 499
- MF → const CountryCode
- Saint Martin (French part) MF MAF 663
- MG → const CountryCode
- Madagascar MG MDG 450
- MH → const CountryCode
- Marshall Islands MH MHL 584
- MK → const CountryCode
- North Macedonia MK MKD 807
- ML → const CountryCode
- Mali ML MLI 466
- MM → const CountryCode
- Myanmar MM MMR 104
- MN → const CountryCode
- Mongolia MN MNG 496
- MO → const CountryCode
- Macao MO MAC 446
- MP → const CountryCode
- Northern Mariana Islands MP MNP 580
- MQ → const CountryCode
- Martinique MQ MTQ 474
- MR → const CountryCode
- Mauritania MR MRT 478
- MS → const CountryCode
- Montserrat MS MSR 500
- MT → const CountryCode
- Malta MT MLT 470
- MU → const CountryCode
- Mauritius MU MUS 480
- MV → const CountryCode
- Maldives MV MDV 462
- MW → const CountryCode
- Malawi MW MWI 454
- MX → const CountryCode
- Mexico MX MEX 484
- MY → const CountryCode
- Malaysia MY MYS 458
- MZ → const CountryCode
- Mozambique MZ MOZ 508
- NA → const CountryCode
- Namibia NA NAM 516
- NC → const CountryCode
- New Caledonia NC NCL 540
- NE → const CountryCode
- Niger NE NER 562
- NF → const CountryCode
- Norfolk Island NF NFK 574
- NG → const CountryCode
- Nigeria NG NGA 566
- NI → const CountryCode
- Nicaragua NI NIC 558
- NL → const CountryCode
- Netherlands NL NLD 528
- NO → const CountryCode
- Norway NO NOR 578
- NP → const CountryCode
- Nepal NP NPL 524
- NR → const CountryCode
- Nauru NR NRU 520
- NU → const CountryCode
- Niue NU NIU 570
- NZ → const CountryCode
- New Zealand NZ NZL 554
- OM → const CountryCode
- Oman OM OMN 512
- PA → const CountryCode
- Panama PA PAN 591
- PE → const CountryCode
- Peru PE PER 604
- PF → const CountryCode
- French Polynesia PF PYF 258
- PG → const CountryCode
- Papua New Guinea PG PNG 598
- PH → const CountryCode
- Philippines PH PHL 608
- PK → const CountryCode
- Pakistan PK PAK 586
- PL → const CountryCode
- Poland PL POL 616
- PM → const CountryCode
- Saint Pierre and Miquelon PM SPM 666
- PN → const CountryCode
- Pitcairn PN PCN 612
- PR → const CountryCode
- Puerto Rico PR PRI 630
- PS → const CountryCode
- Palestine, State of PS PSE 275
- PT → const CountryCode
- Portugal PT PRT 620
- PW → const CountryCode
- Palau PW PLW 585
- PY → const CountryCode
- Paraguay PY PRY 600
- QA → const CountryCode
- Qatar QA QAT 634
- RE → const CountryCode
- Réunion RE REU 638
- RO → const CountryCode
- Romania RO ROU 642
- RS → const CountryCode
- Serbia RS SRB 688
- RU → const CountryCode
- Russian Federation RU RUS 643
- RW → const CountryCode
- Rwanda RW RWA 646
- SA → const CountryCode
- Saudi Arabia SA SAU 682
- SB → const CountryCode
- Solomon Islands SB SLB 90
- SC → const CountryCode
- Seychelles SC SYC 690
- SD → const CountryCode
- Sudan SD SDN 729
- SE → const CountryCode
- Sweden SE SWE 752
- SG → const CountryCode
- Singapore SG SGP 702
- SH → const CountryCode
- Saint Helena, Ascension and Tristan da Cunha SH SHN 654
- SI → const CountryCode
- Slovenia SI SVN 705
- SJ → const CountryCode
- Svalbard and Jan Mayen SJ SJM 744
- SK → const CountryCode
- Slovakia SK SVK 703
- SL → const CountryCode
- Sierra Leone SL SLE 694
- SM → const CountryCode
- San Marino SM SMR 674
- SN → const CountryCode
- Senegal SN SEN 686
- SO → const CountryCode
- Somalia SO SOM 706
- SR → const CountryCode
- Suriname SR SUR 740
- SS → const CountryCode
- South Sudan SS SSD 728
- ST → const CountryCode
- Sao Tome and Principe ST STP 678
- SV → const CountryCode
- El Salvador SV SLV 222
- SX → const CountryCode
- Sint Maarten (Dutch part) SX SXM 534
- SY → const CountryCode
- Syrian Arab Republic SY SYR 760
- SZ → const CountryCode
- Eswatini SZ SWZ 748
- TC → const CountryCode
- Turks and Caicos Islands TC TCA 796
- TD → const CountryCode
- Chad TD TCD 148
- TF → const CountryCode
- French Southern Territories TF ATF 260
- TG → const CountryCode
- Togo TG TGO 768
- TH → const CountryCode
- Thailand TH THA 764
- TJ → const CountryCode
- Tajikistan TJ TJK 762
- TK → const CountryCode
- Tokelau TK TKL 772
- TL → const CountryCode
- Timor-Leste TL TLS 626
- TM → const CountryCode
- Turkmenistan TM TKM 795
- TN → const CountryCode
- Tunisia TN TUN 788
- TO → const CountryCode
- Tonga TO TON 776
- TR → const CountryCode
- Turkey TR TUR 792
- TT → const CountryCode
- Trinidad and Tobago TT TTO 780
- TV → const CountryCode
- Tuvalu TV TUV 798
- TW → const CountryCode
- Taiwan, Province of China TW TWN 158
- TZ → const CountryCode
- Tanzania, United Republic of TZ TZA 834
- UA → const CountryCode
- Ukraine UA UKR 804
- UG → const CountryCode
- Uganda UG UGA 800
- UM → const CountryCode
- United States Minor Outlying Islands UM UMI 581
- US → const CountryCode
- United States of America US USA 840
- UY → const CountryCode
- Uruguay UY URY 858
- UZ → const CountryCode
- Uzbekistan UZ UZB 860
- VA → const CountryCode
- Holy See VA VAT 336
- VC → const CountryCode
- Saint Vincent and the Grenadines VC VCT 670
- VE → const CountryCode
- Venezuela (Bolivarian Republic of) VE VEN 862
- VG → const CountryCode
- Virgin Islands (British) VG VGB 92
- VI → const CountryCode
- Virgin Islands (U.S.) VI VIR 850
- VN → const CountryCode
- Viet Nam VN VNM 704
- VU → const CountryCode
- Vanuatu VU VUT 548
- WF → const CountryCode
- Wallis and Futuna WF WLF 876
- WS → const CountryCode
- Samoa WS WSM 882
- YE → const CountryCode
- Yemen YE YEM 887
- YT → const CountryCode
- Mayotte YT MYT 175
- ZA → const CountryCode
- South Africa ZA ZAF 710
- ZM → const CountryCode
- Zambia ZM ZMB 894
- ZW → const CountryCode
- Zimbabwe ZW ZWE 716