itomo_locale_core

ISO-driven world data for Dart: countries, currencies, languages, scripts, and IANA timezones.

The package ships pre-generated constants and lookup maps for fast reads with no runtime fetch step.

Installation

dependencies:
  itomo_locale_core: ^0.1.6

Quick start

import 'package:itomo_locale_core/itomo_locale_core.dart';

void main() {
  final vn = WorldCountry.fromCca2('VN');
  print(vn.commonName); // Vietnam

  final usd = FiatCurrency.fromAlpha3('USD');
  print(usd.format(1234.56));

  print(getTextDirection('mn-Mong-MN')); // ttb
}

Public API

Countries (WorldCountry)

  • Lookup: fromCca2(code), fromCca3(code), fromCcn3(code), fromAnyCode(code)
  • Nullable lookup: maybeFromCca2(code), maybeFromCca3(code), maybeFromNumeric(code), maybeFromAnyCode(code)
  • Collections: list, map, mapByCca2, mapByNumeric
  • Queries:
    • getIndependent(), getUnMembers()
    • getByRegion(region), getByContinent(continent)
    • getByLanguage(iso6393), getByCurrency(alpha3)
    • getByTimezone(tzId), getByCallingCode(code), getByRegionalBloc(bloc)
    • getBorderingCountries(cca3)
    • getSubdivisions(cca2), getSubdivisionByCode(cca2, code), getSubdivisionsByType(cca2, type)
    • search(query, {locale})

Currencies (FiatCurrency)

  • Lookup: fromAlpha3(code), fromNumeric(code)
  • Nullable lookup: maybeFromAlpha3(code), maybeFromNumeric(code), maybeFromAnyCode(code), getByAnyCode(code)
  • Collections: list, map
  • Queries: getActive(), getDeprecated(), getByType(type), getByCountry(cca2), search(query)
  • Formatting: instance format(amount), static formatAmount(alpha3, amount)

Languages (NaturalLanguage)

  • Lookup: fromIso6391(code), fromIso6392b(code), fromIso6392t(code), fromIso6393(code), fromAnyCode(code)
  • Nullable lookup: maybeFromIso6391(code), maybeFromIso6392b(code), maybeFromIso6392t(code), maybeFromIso6393(code)
  • Collections: list, map, mapByIso6391
  • Queries: getLiving(), getRtl(), getByFamily(family), getByScript(iso15924), getByCountry(alpha2)

Scripts (WorldScript)

  • Lookup: fromIso15924(code)
  • Nullable lookup: maybeFromIso15924(code)
  • Collections: list, map

Timezones (IanaTimezone)

  • Lookup: fromId(id)
  • Nullable lookup: maybeFromId(id)
  • Collections: list, map
  • Queries: getByCountry(cca2), getByRegion(area), getByUtcOffset(minutes), getByUtcOffsetString(offset), getCanonical(), search(query)
  • Utilities: getCurrentUtcOffset(tzId, {when}), isDaylightSavingActive(tzId, {when}), reinterpretInTimezone(date, fromTz, toTz)

Locale/i18n helpers

  • buildLocaleTag(language, [script, region])
  • parseLocaleTag(tag)
  • getCountryFromLocale(locale)
  • getLanguageFromLocale(locale)
  • getPhoneCode(cca2)
  • parsePhonePrefix(phone)
  • getTextDirection(iso6391OrLocale)
  • isRtlLanguage(iso6391OrLocale)

Notes

  • Subdivision APIs are available and return empty lists when subdivision data is not present in the generated dataset.
  • getCurrentUtcOffset uses a best-effort seasonal approximation for DST zones in core.

Use itomo_locale_l10n for CLDR-based localized display names and localized search helpers.

License

MIT © iTomo Vietnam

Libraries

itomo_locale_core
itomo_locale_core — ISO-driven world data for Dart.