API Reference
API Reference
A complete reference of all public APIs available in each package.
Types
Country
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (e.g. "unitedStates") |
alpha2Code | string | ISO 3166-1 alpha-2 (e.g. "US") |
alpha3Code | string | ISO 3166-1 alpha-3 (e.g. "USA") |
numericCode | number | ISO 3166-1 numeric (e.g. 840) |
nativeName | string | Native country name |
capital | string | Capital city |
mainLanguage | string | Primary language code |
languages | string[] | All spoken language codes |
tld | string | Top-level domain |
callingCode | number | International calling code |
continent | string | Continent identifier |
currency | string | Currency code |
Language
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (e.g. "english") |
code | string | ISO 639-1 code (e.g. "en") |
nativeName | string | Name in the language itself |
dialects | LanguageDialect[] | Regional variations |
defaultFlagCode | string? | Country code for representative flag |
LanguageDialect
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier |
code | string | Dialect code |
nativeName | string | Native name of the dialect |
flagCode | string? | Country code for the dialect's flag |
Currency
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (e.g. "usd") |
code | string | ISO 4217 code (e.g. "USD") |
nativeName | string | Singular name (e.g. "US Dollar") |
nativeNamePlural | string | Plural name (e.g. "US Dollars") |
symbol | string | Currency symbol (e.g. "$") |
Continent
| Field | Type | Description |
|---|---|---|
id | string | Unique identifier (e.g. "europe") |
code | string | Two-letter code (e.g. "EU") |
name | string | English display name |
Lookup Functions
Countries
GoDartTypeScriptphp
// TypeScript
getCountryByAlpha2(code: string): Country | undefined
getCountryByAlpha3(code: string): Country | undefined
getCountriesByContinent(continent: string): Country[]
getCountriesInContinent(code: string): Country[]Languages
GoDartTypeScriptphp
// TypeScript
getLanguageByCode(code: string): Language | undefinedCurrencies
GoDartTypeScriptphp
// TypeScript
getCurrencyByCode(code: string): Currency | undefinedContinents
GoDartTypeScriptphp
// TypeScript
getContinentByCode(code: string): Continent | undefinedFlags
GoDartTypeScriptphp
// TypeScript
getFlag(alpha2: string): string | undefined
flags // Record<string, string>Emoji Flags
GoDartTypeScriptphp
// TypeScript
getEmojiFlag(alpha2: string): stringEnums / Constants
Each package provides type-safe constants for all codes:
GoDartTypeScriptphp
// TypeScript — string enums
CountryCode.US // "US"
LanguageCode.FR // "FR"
CurrencyCode.EUR // "EUR"
ContinentCode.EU // "EU"Translation Functions
All translation functions take an entity code and a locale code, returning the localized name.
Available locales: da, de, en, es, fr, it, zh
GoDartTypeScriptphp
// TypeScript
getCountriesName(code: string, locale: string): string | undefined
getLanguagesName(code: string, locale: string): string | undefined
getCurrenciesName(code: string, locale: string): string | undefined
getContinentsName(code: string, locale: string): string | undefined
getCapitalsName(code: string, locale: string): string | undefinedTranslation Maps
For bulk access, raw translation maps are available:
GoDartTypeScriptphp
// TypeScript
countriesTranslations // Record<string, Record<string, string>>
languagesTranslations
currenciesTranslations
continentsTranslations
capitalsTranslations