diff --git a/CHANGELOG.md b/CHANGELOG.md index 05d6a97..167408c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 1.0.14 + +* Fix: Ensure sorting is applied only to the country list and not to favorite countries + ## 1.0.13 * Add localizations for Urdu diff --git a/lib/src/_country_selector_controller.dart b/lib/src/_country_selector_controller.dart index 45a0262..3ea79fc 100644 --- a/lib/src/_country_selector_controller.dart +++ b/lib/src/_country_selector_controller.dart @@ -20,7 +20,7 @@ class CountrySelectorController with ChangeNotifier { List countriesIsoCode, List favoriteCountriesIsoCode, ) { - _countries = _buildLocalizedCountryList(context, countriesIsoCode); + _countries = _buildLocalizedCountryList(context, countriesIsoCode)..sort((a, b) => a.name.compareTo(b.name)); _favoriteCountries = _buildLocalizedCountryList(context, favoriteCountriesIsoCode); _filteredCountries = _countries; @@ -60,7 +60,6 @@ class CountrySelectorController with ChangeNotifier { localization.countryName(isoCode), ), ) - .toList() - ..sort((a, b) => a.name.compareTo(b.name)); + .toList(); } } diff --git a/pubspec.yaml b/pubspec.yaml index c505071..edf3e07 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_country_selector description: how a country picker to select a country -version: 1.0.13 +version: 1.0.14 repository: https://github.com/cedvdb/flutter_country_selector homepage: https://github.com/cedvdb/flutter_country_selector