sealed_countries 2.8.0
sealed_countries: ^2.8.0 copied to clipboard
Provides data for world countries in the form of sealed classes.
2.8.0 #
NEW FEATURES
- This version introduces named (Dart 3.10 dot-shorthand compatible) constructors for ISO classes, refactoring the ISO data files to use a factory constructor pattern with extension types. The changes transform the direct constructor calls into a more structured factory-based approach while maintaining backward compatibility. For example, instead of using
CountrySvk(), you can now useWorldCountry.svk(). This change enhances code readability and aligns with modern Dart practices.
const country = CountrySvk(); // Old way (still supported).
const country = WorldCountry.svk(); // New way, or just .svk() in Dart 3.10.
print([WorldCountry.svk(), WorldCountry.cze()]); // Collections, 3.9 way.
// You can also use the new dot-shorthand syntax introduced in Dart 3.10:
print(<WorldCountry>[.svk(), .cze()]); // Collections, 3.10 way.
CHORE
- Bulgarian
currenciesarray updated to reflect current usage of both BGN and EUR in Bulgaria.
2.7.1 #
REFACTOR
- Marked
permissiveconstructors and translation-related parameters as deprecated; deprecated a translation interface and related extension methods.
CHORE
- Enable and fix 10 new Dart Code Metrics rules (from the 1.32.0: October Update).
2.7.0 #
NEW FEATURES
- Adds support for
XCG(Caribbean Guilder) andZWG(Zimbabwean Gold) currencies with translations (across 100+ locales each). - Deprecates
ANG,BGN, andZWLcurrencies with appropriate migration paths.
FIX
- Corrected Slovak country name for
CIVto "Pobrežie Slonoviny". - Corrected English currency name for
KGSto "Kyrgyzstani Som". - Corrected English currency name for
GYDto "Guyanese Dollar".
DOCUMENTATION
- Improved documentation in README.
2.6.0 #
FIX
CountryName's short flag (true) intoString()override returnscommonname, same way, as in parent's (TranslatedNameclass) override.
CHORE
- The Dart SDK was bumped to v3.9.2.
2.5.0 #
FIX
- Updated country data with recent population, Gini, and capital information.
- Fixed demonyms, borders, and native names for select countries.
- Corrected Welsh official country name for Curaçao.
- Corrected Korean localization for British Indian Ocean Territory, Dominica, Mongolia, Wallis and Futuna and South Georgia.
- Corrected
subunitToUnitvalue for Hungarian Forint.
NEW FEATURES
- Updated language metadata to better reflect writing systems and script directionality for many languages.
REFACTOR
- Marked certain currencies as deprecated and updated related comments.
- Corrected country and language associations in documentation for currencies and languages.
- Standardized code normalization using new ISO code extension types, replacing older string and object extension methods.
- Deprecated legacy constant lists in favor of centralized static lists for ISO classes.
- Deprecated functional-style pattern matching methods and boolean type-check getters across ISO/sealed models. Users are advised to use switch expressions or direct equality/type checks instead.
- Deprecated extensions providing
is*getters in favor of direct type checks. - Standardized method return types for map serialization to use stronger, standard Dart Map types.
- Simplified code by removing redundant comments and improving null-aware syntax usage.
CHORE
- The Dart SDK was bumped to v3.8.1.
- Refined static analysis and linting rules, including enabling and disabling specific Dart Code Metrics rules.
DOCUMENTATION
- Improved formatting, fixed typos, and updated usage examples in README.
TEST
- Removed outdated test files related to deprecated APIs.
- Added or updated test cases to cover new behaviors and deprecation handling.
2.4.0 #
NEW FEATURES
- Added new collections and extensions for mapping currencies and languages to countries (via
byCountryMapmethod), including support for unofficial and constructed languages. - Introduced methods to prioritize and customize country associations for languages and currencies.
CHORE
- The Dart SDK was bumped to v3.8.1.
- Update German and English translations (for multiple countries).
- Updated official
languageslists for Ethiopia and Iraq to reflect additional recognized languages.
DOCUMENTATION
- Added auto-generated markdown tables listing global currencies and languages with their associated countries.
2.3.0 #
NEW FEATURES
- Enhance ISO standardized classes with
Comparableinterface and update bool getters. - Add regional code alias and new ISO standardized extensions for type checking.
- Add official country translations for the Indonesian language.
- Update symbol for Sudanese pound to "ج.س".
CHORE
- The Dart SDK was bumped to v3.8.0.
- Code has been formatted with the new Dart formatter.
- Correct latitude values for several countries.
- Update currency for South Georgia to GBP.
REFACTOR
- Make copy-with extensions generic for ISO standardized classes.
DOCUMENTATION
- Improved documentation in README.
- Update dartdoc in ISO standardized classes instances to use backticks.
TEST
- Add tests for comparable boolean getters in ISO standardized classes.
- Add unit tests for regional code and ISO standardized extensions.
2.2.0 #
This is a maintenance release without significant changes for the users, which aims to improve documentation and DevEx.
NEW FEATURES
- Added the
regionalCodegetter to theBasicTypedLocaleto provide a convenient alias for thecountryCodeproperty, improving consistency when working with regional locales.
DOCUMENTATION
- Update documentation for countries to use backticks for ISO code formatting.
CHORE
- Dart SDK bumped to v3.7.0.
- Code is formatted with the new Dart formatter.
2.1.0 #
REFACTOR
- Nullable
maybeCommonNameFormethod now accepts nullablemainLocaleparameter - ifnullis provided,nullwill be returned.
2.0.1 #
REFACTOR
- Improved generics handling in localization methods.
- Update and use stable L10N package.
DOCUMENTATION
- Improved documentation and example.
- Fixed typos in the README.
2.0.0 #
🎉 Second anniversary and new major release!
NEW FEATURES
- Introduced new methods for working with common names and common name maps:
commonNamesMapon ISO collections andcommonNameFor/maybeCommonNameForon ISO objects. These methods are significantly faster than the oldtranslations- related methods because they work directly with locale-specific maps instead of iterating through all translations of each ISO object. - The
translationsgetter is now a computed field. This means it will only generate the translations when they are requested, rather than storing them all in memory. It's recommended to cache the results of the getter to avoid redundant calculations. Because of that -translationandmaybeTranslationmethods are no longer recommended for retrieving localization data. - The
commonNamesCacheMapis deprecated because it relies on the memory-intensivetranslationsgetter. - New localization delegates on
IsoTranslatedobjects simplify complex queries for object localizations. - Bool getters on
IsoStandardizedobjects can now be applied to null values. For example,maybeIso.isRuswill returnfalseifmaybeIsois null, without the need for additional null-checks.
FIX
- Changed official name for Portugal: "República português" > "República Portuguesa".
- Change the capital of Indonesia for Nusantara: "Jakarta" > "Nusantara".
BREAKING CHANGES
- The package now requires Dart v3.6.0 or higher.
- The
IsoTranslated<T, N, L>class now uses three generic types instead of two. If you used this class directly in your code, simply add the additional generic<L extends BasicLocale>to your reference. - The default
toString()implementation ofBasicLocalenow uses Flutter'sLocale-like output format. You can still access the old output by setting theshortflag tofalse. - The
sealed_country_translationslibrary is deprecated. Migrate to the l10n_countries package or usel10ngetter in ISO objects that provides the same data without holding all translations in memory. This sub-library and its content (except for supported locales lists - they will be moved to the main library) will be removed in the next major package version. - Translation methods requires
BasicTypedLocaleinstead ofBasicLocale, if you didn't used country value - this change will not affect you, otherwise please change from:
BasicLocale(*, countryCode: "US");
to:
BasicTypedLocale(*, regionalCode: "US"); // or BasicTypedLocale(*, country: CountryUsa());
1.5.1 #
NEW FEATURES
- Updated the postal code pattern format for Paraguay.
- Updated International Olympic Committee (IOC) country code for Bahrain.
- Improvements of
toString()method implementations in models and addressing new lints + DCM reports. - Added "polski" to the Polish language's
namesNativearray.
1.5.0 #
This is the last minor version update with significant changes for some time. The next steps will be patches at most. Currently working on v2.0.0 which will bring new data and a big feature there, very likely without breaking the existing API.
NEW FEATURES
- 🎉 All translations in the eco-system packages now support all GlobalMaterialLocalizations and GlobalCupertinoLocalizations locales.
- 🦾 Countries translations now also support all
GlobalMaterialLocalization+GlobalCupertinoLocalizationslocales. - The
localeparameter in themaybeTranslationmethod is now nullable. - The
permissiveconstructors are now even more permissive, onlynameandcodeparameters remain required. - Changed Vatican city
unMemberfield tofalseand fix Cape Verde coordinates Link to MR
1.4.0 #
NEW FEATURES
- 🦾 Language translations now also support all
GlobalMaterialLocalization+GlobalCupertinoLocalizationslocales. - Added new
internationalNamegetter inIsoStandardizedinterface, representing the international name of the ISO object. - Added new
UpperCaseMapclass, thatUpperCaseIsoMapextends, a simple version ofUpperCaseIsoMapwithout key length checks andIsoStandardizedvalues requirement. - The
mapin theRegionalBlocis nowUpperCaseMap(with all it's benefits). - Added new
maybeFromAcronymfactory method in theRegionalBloc. - Added new
BasicLocaleclass, thatTranslatedNameextends. Representing a type-safe world locale (language, country/region code and script). - Added new
commonNamesCacheMapmethod for all ISO based sealed classes collections, which allows to create a cache map of common names translations for the givenBasicLocale.
BREAKING CHANGES
Because of the BasicLocale changes (described above), translation() and maybeTranslation() methods on the Translated classes now require BasicLocale input. If you are not using those methods directly, then you don't need to change anything, otherwise you will need to do small adjustment - wrap the content of those methods with a BasicLocale.
Before:
print(iso?.maybeTranslation(LangPor()));
After:
print(iso?.maybeTranslation(BasicLocale(LangPor())));
Or just:
- Enable Regular Expressions in your IDE's Find and Replace panel.
- In the Find field, enter the regex:
(translation\()(.*)(\)) - In the Replace field, enter:
$1BasicLocale($2)$3 - Execute the replace operation.
1.3.1 #
NEW FEATURES
- Fix thousands separator for CHF.
codeOtheris no longer nullable (in allIsoStandardizedclasses).- Added new compile-time constant and case-insensitive code maps (
UpperCaseIsoMaps) in every ISO class (accessible as static constants via.map,.codeMap,.codeNumericMap, etc.). - Factory constructors and methods now using those maps if no (optional) array is provided there.
- Factory constructors and methods in
IsoStandardizedclasses now allow non-String inputs - anyObject, for example you can now useStringBufferorEnuminstances directly:
enum IsoEnum {de, fr, ar} // On .fromCode(IsoEnum.de) call it will use "DE" input.
or you can basically use any custom class with toString() override:
class CustomIsoCodeClass {
const CustomIsoCodeClass({String code = '123', this.foo}) : _code = code;
final String _code;
final Foo? foo;
@override
String toString() => _code; // Has to override toString() with ISO value.
}
// On .fromAnyCode(CustomIsoCodeClass(code: ' 321 ')) call it will use "321" input.
REFACTOR
- Refactored asserts in
maybeMapIsoCodemethod. - Fixed typos in CHANGELOG and README.
1.2.0 #
NEW FEATURES
- Added new static
maybeFrom*methods and refactored old ones. They are also now accept anyObject?input instead of justString?. - Added new and refactored old tests with a performance in mind.
- Added new
firstIsoWhere*extensions on ISO iterables. - Added
is*boolean getters for example:
if (isoObject.isFra) return _onFrance();
is more readable and shorter equivalent of this check:
if (isoObject == const CountryFra()) return _onFrance();
1.1.0 #
NEW FEATURES
- Added new constructor called
permissive- which allow the creation of custom class instances that are not fully compatible with the ISO standard. Translatedclass is now sealed - which means you can now directly compare instances of different ISO classes directly (for example in switch statements).
1.0.0 #
🎉 First anniversary and first stable release!
NEW FEATURES
- Added new getter for
TranslatedNamename calledcommon, which might be useful in some cases whennameis being used by a parent class. - Added a lot of translations from the Symfony.
- Currencies translations now support all GlobalMaterialLocalizations and GlobalCupertinoLocalizations locales.
- Updated LICENSE.
BREAKING CHANGES
- Removed code marked as
Deprecatedin previous releases. - Replaced old
FiatCurrency.listwith a newFiatCurrency.listExtended. - Removed
FiatCurrency.regularList(please useFiatCurrency.listinstead). - Marked Croatian Kuna as
Deprecated(currencies).
0.9.0 #
NEW FEATURES
- Added new interface
IsoTranslatedwhich combinesTranslatedandIsoStandardizedinterfaces. - Added
standard*static constants in theWorldCountryclass referencing different names of the ISO 3166-1 standard. - Added
standard*static constants in theFiatCurrencyclass referencing different names of the ISO 4217 standard. - Improved documentation in README, added FAQ.
0.8.0 #
NEW FEATURES
- Added new factories to
WorldCountry-fromCodeNumericwhich returns instance by it's numeric code andfromAnyCode, which do the length and type checks and redirects to otherfromCode\*constructors - Added new static method to
WorldCountry-maybeFromAnyCode, which works same way asfromAnyCode, but doesn't throwsStateErrorsif no currency object is found. - Added
maybeMapIsoCodemethod toStringextensions, which is used under the hood of(maybe)fromAnyCode.
REFACTOR
- Named classes now has boolean flag (
short, defaults totrue). TranslatedNameclass by default returns.namevalue ontoString().- Refactored dollar symbols in
toString()methods.
0.7.0 #
NEW FEATURES
WorldCountryclass now contains way more translations of language name to other languages (79 translations for each language minimum).- Refactored factory constructors - there is an optional parameter to provide custom list.
- Added
regularListgetter for the list of regular currencies (excludes 10 currencies from thespecialPurposeList). FiatCurrencyclass now contains translations of language name to other languages (79 translations for each language minimum).- Those translations are also accessible from the
translationandmaybeTranslationmethods. - Added
TranslatedNameclass for thetranslations. - Implement new abstract interfaces for currencies:
NamedandTranslated. - Added a new sealed class called
Script, based on the ISO 15924 standard. - The
NaturalLanguageclass now contains information about scripts (writing systems) and translations of the language name to other languages.
FIX
- Fixed several English currency names.
0.6.0 #
NEW FEATURES
- Added
copyWith,toJsonetc. to theWorldCountry,FiatCurrency,NaturalLanguageclasses. - Added copyWith, toJson etc. to all country-related sub-classes.
- Added new interfaces (
IsoStandardized,JsonEncodable) and typedef (JsonMap) to the model. - Refactoring in existing functional methods (sorting params to match list sorting).
- Translations are now
List<TranslatedName>instead ofList<CountryName>, howeverCountryNameis just an extension on top ofTranslatedName(you can reference to name instead ofcommonandfullNameinstead of official). There will be way more translations provided in upcoming version 0.7.0. - Renaming of extensions to follow the eco-system naming pattern.
0.5.0 #
- Factory constructors and static methods for data classes creation now implicitly trimming and comparing uppercase string inputs.
- Fixing old ignores and new linter rules.
- Updates in
dev_dependencies. - Added new data sealed classes related to world blocs.
- Regional blocs are now part of the world country data.
- Added regional blocs in the example
FIX
- Zimbabwean Dollar (ZWL) is now properly placed as last item in currencies list.
- Timezones for the Netherlands.
BREAKING CHANGES
WorldCountry.listis now sorted alphabetically by the (3 letter)code.
0.2.2 #
REFACTOR
- Updates in
dev_dependencies.
0.2.1 #
DOCUMENTATION
- Provided structure screenshot.
0.2.0 #
TEST
- Increase code coverage to 100%.
0.1.0 #
DOCUMENTATION
- Provided code coverage links and badge.
0.0.1 #
- Initial release.
