Skip to content

Commit 8162ed5

Browse files
committed
🔖 Package version 1.0.2 released
⚡️ Migrate to null safety
1 parent 539abce commit 8162ed5

9 files changed

Lines changed: 265 additions & 226 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## [1.0.2] 12 May 2021
2+
* Migrate to Null Safety
13
## [1.0.1] - 01 Jun 2020
24

35
* Added Domain, Numeric code, CISO, Lat long, Language name code and symbol

README.md

Lines changed: 50 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Country Provider is a flutter library wrapper around the API provided by REST Co
1515
```yaml
1616

1717
dependencies:
18-
country_provider: ^0.0.1
18+
country_provider: ^0.0.2
1919

2020
```
2121

@@ -35,14 +35,14 @@ Each method return a `List` of [`Country`](https://github.com/TheAlphamerc/count
3535

3636
```dart
3737
// Get all countries
38-
List<Country> countries = await CountryProvider.getAllCountries();
38+
List<Country>? countries = await CountryProvider.getAllCountries();
3939
```
4040

4141
- Search by country name. It can be the native name or partial name.
4242

4343
```dart
4444
// Search by country name
45-
List<Country> result = await CountryProvider.getCountriesByName("Ameri");
45+
List<Country>? result = await CountryProvider.getCountriesByName("Ameri");
4646
```
4747

4848
If partial name, this method could return a list of countries. Else a List of one element.
@@ -65,21 +65,21 @@ Country result = await CountryProvider.getCountryByCode("Ind")?.first;
6565

6666
```dart
6767
// Search by list of ISO 3166-1 2-letter or 3-letter country codes
68-
List<Country> result =await CountryProvider.getCountriesByListOfCodes(["Ind", "col", "ru"]);
68+
List<Country>? result =await CountryProvider.getCountriesByListOfCodes(["Ind", "col", "ru"]);
6969
```
7070

7171
- Search by ISO 4217 currency code.
7272

7373
```dart
7474
// Search by ISO 4217 currency code
75-
List<Country> result = await CountryProvider.getCountryByCurrencyCode("Inr")
75+
List<Country>? result = await CountryProvider.getCountryByCurrencyCode("Inr")
7676
```
7777

7878
- Search by ISO 639-1 language code.
7979

8080
```dart
8181
// Search by ISO 639-1 language code
82-
List<Country> result = await CountryProvider.getCountriesByLanguageCode(["Hin","en",]);
82+
List<Country>? result = await CountryProvider.getCountriesByLanguageCode(["Hin","en",]);
8383
```
8484

8585
- Search by capital city.
@@ -95,21 +95,21 @@ You can use `var` instead of explicit types. I use explicit types to show you th
9595

9696
```dart
9797
// Search by calling code
98-
List<Country> result = await CountryProvider.getCountryByCallingCode(91);
98+
List<Country>? result = await CountryProvider.getCountryByCallingCode(91);
9999
```
100100

101101
- Search by continent: Africa, Americas, Asia, Europe, Oceania.
102102

103103
```dart
104104
// Search by continent: Africa, Americas, Asia, Europe, Oceania
105-
List<Country> result = await CountryProvider.getcountryByRegionalBloc("Asia");
105+
List<Country>? result = await CountryProvider.getcountryByRegionalBloc("Asia");
106106
```
107107

108108
- Search by regional bloc: EU, EFTA, CARICOM, AU, USAN, EEU, AL, ASEAN , CAIS, CEFTA , NAFTA , SAARC.
109109

110110
```dart
111111
// Search by regional bloc
112-
List<Country> result = await CountryProvider.getCountriesByContinent("ASEAN");
112+
List<Country>? result = await CountryProvider.getCountriesByContinent("ASEAN");
113113
```
114114

115115
**EU** (European Union), **EFTA** (European Free Trade Association), **CARICOM** (Caribbean Community), **PA** (Pacific Alliance), **AU** (African Union), **USAN** (Union of South American Nations), **EEU** (Eurasian Economic Union), **AL** (Arab League), **ASEAN** (Association of Southeast Asian Nations), **CAIS** (Central American Integration System), **CEFTA** (Central European Free Trade Agreement), **NAFTA** (North American Free Trade Agreement), **SAARC** (South Asian Association for Regional Cooperation).
@@ -121,15 +121,15 @@ To get filtered country data pass [CountryFilter](https://github.com/TheAlphamer
121121
```dart
122122
// Get all countries name only
123123
var countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true));
124-
List<string> countriesInSpanish = countries.map((e) => e.name).toList();
124+
List<String> countriesInSpanish = countries.map((e) => e.name).toList();
125125
126126
// Get all countries name only in Spanish
127127
var countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true));
128-
List<string> countriesInSpanish = countries.map((e) => e.translations.es).toList();
128+
List<String> countriesInSpanish = countries.map((e) => e.translations.es).toList();
129129
130130
// Get Europe countries in French language
131131
var europeCountries = await CountryProvider.getcountryByRegionalBloc("Europe",filter: CountryFilter(isName: true));
132-
List<string> europeCountriesInFrench = europeCountries.map((e) => e.translations.fr).toList();
132+
List<String> europeCountriesInFrench = europeCountries.map((e) => e.translations.?fr).toList();
133133
134134
// Get all countries name with their capital city only
135135
var countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true,isCapital:true));
@@ -150,76 +150,76 @@ Default language for country name is English, but you can also get the name in o
150150
class Country
151151
{
152152
// Get Country name
153-
String name;
153+
String? name;
154154
155155
// Gets Top Level Domain
156-
List<String> topLevelDomain;
156+
List<String>? topLevelDomain;
157157
158158
// Gets Alpha2 Code
159-
String alpha2Code;
159+
String? alpha2Code;
160160
161161
// Gets Alpha3 Code
162-
String alpha3Code;
162+
String? alpha3Code;
163163
164164
// Gets Calling Code
165-
List<String> callingCodes;
165+
List<String>? callingCodes;
166166
167167
// Gets Capital City
168-
String capital;
168+
String? capital;
169169
170-
// Get AltSpelling
171-
List<String> altSpellings;
170+
// Get Alt Spelling
171+
List<String>? altSpellings;
172172
173173
// Get Region
174-
String region;
174+
String? region;
175175
176-
// Get SubDomain
177-
String subregion;
176+
// Get Sub region
177+
String? subregion;
178178
179179
// Get Population
180-
int population;
180+
int? population;
181181
182182
// Get Latlng(Latitude and Longitude)
183-
List<double> latlng;
183+
List<double>? latlng;
184184
185185
// Get Demonym
186-
String demonym;
186+
String? demonym;
187187
188188
// Get Area
189-
double area;
189+
double? area;
190190
191191
// Get Gini
192-
double gini;
192+
double? gini;
193193
194194
// Get Timezone
195-
List<String> timezones;
195+
List<String>? timezones;
196196
197197
// Get Borders
198-
List<String> borders;
198+
List<String>? borders;
199199
200200
// Get Native Name
201-
String nativeName;
201+
String? nativeName;
202202
203203
// Get Numeric Code
204-
String numericCode;
204+
String? numericCode;
205205
206206
// Get Currencies
207-
List<Currency> currencies;
207+
List<Currency>? currencies;
208208
209209
// Get Languages
210-
List<Language> languages;
210+
List<Language>? languages;
211211
212212
// Gets Translations
213-
Translations translations;
213+
Translations? translations;
214214
215215
// Get Flag
216-
String flag;
216+
String? flag;
217217
218218
// Get Regional Blocs
219-
List<RegionalBloc> regionalBlocs;
219+
List<RegionalBloc>? regionalBlocs;
220220
221221
// Get Cioc(International Olympic Committee Code)
222-
String cioc;
222+
String ?cioc;
223223
}
224224
```
225225
## CountryFilter Class
@@ -266,13 +266,12 @@ class CountryFilter{
266266
Thanks to Fayder Florez for developing [REST Countries API](https://github.com/fayder/restcountries).
267267

268268

269-
## Flutter plugins
270-
Plugin Name | Stars
271-
:-------------------------|-------------------------
272-
|[Empty widget](https://github.com/TheAlphamerc/empty_widget) |![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/empty_widget?style=social)
273-
|[Add Thumbnail](https://github.com/TheAlphamerc/flutter_plugin_add_thumbnail) |![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/flutter_plugin_add_thumbnail?style=social)
274-
|[Filter List Widget](https://github.com/TheAlphamerc/flutter_plugin_filter_list) |![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/flutter_plugin_filter_list?style=social)
275-
269+
## Other Flutter packages
270+
Name | Stars | Pub |
271+
:-------------------------|------------------------- | ------------------------- |
272+
|[Empty widget](https://github.com/TheAlphamerc/empty_widget) |[![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/empty_widget?style=social)](https://github.com/login?return_to=https://github.com/TheAlphamerc/empty_widget) | [![pub package](https://img.shields.io/pub/v/empty_widget?color=blue)](https://pub.dev/packages/empty_widget) |
273+
|[Add Thumbnail](https://github.com/TheAlphamerc/flutter_plugin_add_thumbnail) |[![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/flutter_plugin_add_thumbnail?style=social)](https://github.com/login?return_to=https://github.com/TheAlphamerc/flutter_plugin_add_thumbnail) | [![pub package](https://img.shields.io/pub/v/add_thumbnail?color=blue)](https://pub.dev/packages/add_thumbnail) |
274+
|[Filter List](https://github.com/TheAlphamerc/flutter_plugin_filter_list) |[![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/flutter_plugin_filter_list?style=social)](https://github.com/TheAlphamerc/flutter_plugin_filter_list) | [![pub package](https://img.shields.io/pub/v/filter_list?color=blue)](https://pub.dev/packages/filter_list) |
276275

277276
## Pull Requests
278277

@@ -285,9 +284,14 @@ I welcome and encourage all pull requests. It usually will take me within 24-48
285284

286285
> If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of :coffee:
287286
>
287+
288+
> * <a href="https://www.buymeacoffee.com/thealphamerc"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="30"></a>
288289
> * [PayPal](https://www.paypal.me/TheAlphamerc/)
289290
290-
> You can also nominate me for Github Star developer program https://stars.github.com/nominate
291+
292+
## Visitors Count
293+
294+
<img align="left" src = "https://profile-counter.glitch.me/country_provider/count.svg" alt ="Loading">
291295

292296

293297

0 commit comments

Comments
 (0)