Skip to main content

worldref 1.2.0 copy "worldref: ^1.2.0" to clipboard
worldref: ^1.2.0 copied to clipboard

Every country in Arabic, English, or both, with nationalities, dial codes, phone validation, Arabic-aware search and sorting.

worldref (Dart / Flutter) #

Countries and territories in Arabic and English: names, ISO codes, phone plans, currencies, geo, locale, search and sorting. No runtime dependencies; works in Flutter, including web.

Install from GitHub #

dependencies:
  worldref: ^1.2.0

Usage #

import 'package:worldref/worldref.dart';

final sa = byIso2('sa')!;                              // case-insensitive lookup
print(sa.nameAr);                                      // السعودية
print(search(countries, 'مملكة', Lang.ar).first.iso2); // SA
print(search(countries, 'Kuwiat').first.iso2);         // KW (forgives small typos)
print(search(countries, 'saudiarabia').first.iso2);    // SA (spaces optional)
print(sortCountries(countries, Lang.ar, 'SA').first.iso2);
final p = parsePhone('0501234567', sa, countries);
print('${p?.e164} ${p?.valid} ${p?.mobile}');          // +966501234567 true true
print(isValidMobile('+966501234567', sa, countries));
print(subdivisionsOf('SA').length);
for (final line in addressForm(byIso2('US')!, Lang.en)) {
  print(line.map((f) => '${f.label}${f.required ? ' *' : ''}').join(' | '));
}                                                      // ... City * | State * | ZIP code *

API: countries, byIso2, subdivisions, subdivisionsOf, normalize, westernDigits, search, editDistance, sortCountries, parsePhone, isValidMobile, formatNational, addressForm. Data is parsed lazily on first use.

Test #

cd dart && dart pub get && dart test
0
likes
120
points
779
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Every country in Arabic, English, or both, with nationalities, dial codes, phone validation, Arabic-aware search and sorting.

Homepage
Repository (GitHub)
View/report issues
Contributing

Topics

#countries #arabic #i18n #phone #dataset

License

unknown (license)

More

Packages that depend on worldref