itomo_locale_core
ISO-driven world data for Dart: countries, currencies, languages, scripts, timezones — zero dependencies, all data as compile-time const.
Release status
GitHub-only for now (not published to pub.dev yet).
Install
dependencies:
itomo_locale_core:
path: ../itomo_locale/packages/dart-core
Usage
import 'package:itomo_locale_core/itomo_locale_core.dart';
void main() {
final vn = WorldCountry.fromCca2('VN');
print(vn.namesNative.first.common); // Việt Nam
final all = WorldCountry.list;
print(all.length); // 250 (when full data set is generated)
}
API
WorldCountry
- Factories/lookups:
WorldCountry.fromCca2(code)WorldCountry.fromCca3(code)WorldCountry.fromCcn3(code)WorldCountry.fromAnyCode(code)WorldCountry.maybeFromCca2(code)WorldCountry.maybeFromCca3(code)WorldCountry.maybeFromNumeric(code)WorldCountry.maybeFromAnyCode(code) - Queries:
WorldCountry.getIndependent()WorldCountry.getUnMembers()WorldCountry.getByRegion(region)WorldCountry.getByContinent(continent)WorldCountry.getByLanguage(iso6393)WorldCountry.getByCurrency(alpha3)WorldCountry.getByTimezone(tzId)WorldCountry.getByCallingCode(code)WorldCountry.getByRegionalBloc(bloc)WorldCountry.getBorderingCountries(cca3)WorldCountry.getSubdivisions(cca2)WorldCountry.getSubdivisionByCode(cca2, code)WorldCountry.getSubdivisionsByType(cca2, type)WorldCountry.search(query, {locale})
FiatCurrency
- Factories/lookups:
FiatCurrency.fromAlpha3(code)FiatCurrency.fromNumeric(code)FiatCurrency.maybeFromAlpha3(code)FiatCurrency.maybeFromNumeric(code)FiatCurrency.getByAnyCode(code)FiatCurrency.maybeFromAnyCode(code) - Queries:
FiatCurrency.getActive()FiatCurrency.getDeprecated()FiatCurrency.getByType(type)FiatCurrency.getByCountry(cca2)FiatCurrency.search(query) - Formatting:
currency.format(amount)FiatCurrency.formatAmount(alpha3, amount)
NaturalLanguage
- Factories/lookups:
NaturalLanguage.fromIso6391(code)NaturalLanguage.fromIso6392b(code)NaturalLanguage.fromIso6392t(code)NaturalLanguage.fromIso6393(code)NaturalLanguage.fromAnyCode(code)NaturalLanguage.maybeFromIso6391(code)NaturalLanguage.maybeFromIso6392b(code)NaturalLanguage.maybeFromIso6392t(code)NaturalLanguage.maybeFromIso6393(code) - Queries:
NaturalLanguage.getLiving()NaturalLanguage.getRtl()NaturalLanguage.getByFamily(family)NaturalLanguage.getByCountry(cca2)NaturalLanguage.getByScript(iso15924)
WorldScript
WorldScript.fromIso15924(code)WorldScript.maybeFromIso15924(code)
IanaTimezone
- Factories/lookups:
IanaTimezone.fromId(id)IanaTimezone.maybeFromId(id) - Queries:
IanaTimezone.getByCountry(cca2)IanaTimezone.getByRegion(region)IanaTimezone.getByUtcOffset(offsetMinutes)IanaTimezone.getByUtcOffsetString(offset)IanaTimezone.getCanonical()IanaTimezone.search(query) - Time utilities:
IanaTimezone.getCurrentUtcOffset(tzId, {when})IanaTimezone.isDaylightSavingActive(tzId, {when})IanaTimezone.reinterpretInTimezone(date, fromTz, toTz)
i18n helpers
buildLocaleTag(language, [script, region])parseLocaleTag(tag)getCountryFromLocale(locale)getLanguageFromLocale(locale)getPhoneCode(cca2)parsePhonePrefix(phone)getTextDirection(iso6391OrLocale)isRtlLanguage(iso6391OrLocale)
Features
- ISO 3166-1 / 3166-2 countries (alpha-2, alpha-3, numeric)
- ISO 4217 currencies
- ISO 639-1/2/3 languages
- ISO 15924 scripts
- IANA TZDB timezones
- All data is
const— zero allocation, zero startup cost - Sealed class hierarchy for exhaustive pattern matching
See the example/ for a complete usage demo.
License
MIT © iTomo Vietnam
Libraries
- itomo_locale_core
itomo_locale_core— ISO-driven world data for Dart.