Comments (8)
Hi @miguelpruivo thank you for the quick answer.
The issue above happened to me on an Android emulator but I also checked on physical Pixel 2 XL and OnePlus 6 and it also happens there. For some reason, countryCode
is still null.
What about accessing CountryDetails map keys by languageCode
instead? This property is a required one on Locale object.
from country_codes.
@kightsonsanom I'm afraid that every device should have a country associated because the language tag must be from a country. This is, en
can be a language tag from many countries, and this could result in wrong information being provided. How could one tell if en
is from US or GB, for example?
I'm surprised that in Android devices you are experiencing this. Might have to investigate this. At first, this was only an issue with iOS simulators.
from country_codes.
Hi @kightsonsanom, this is not actually a bug with the plugin itself but rather from iOS simulator that you might be using with it.
For some reason, iOS simulators don't have a default country set (this doesn't ever happen with real devices btw) and you'll need to go to settings > general > language & region > region > select one, even if it's already selected. After that you should be fine.
Anyway, I've updated the assert
to also make sure that countryCode
is not null
and provide this same information to the developer as it may be missed at first.
Let me know if it worked for you.
Thanks!
from country_codes.
I agree that the country code is necessary for this case. If you find yourself not able to reproduce the issue I can provide more details. Thanks!
from country_codes.
@kightsonsanom yes, that would be great. How do you manage to replicate it consistently?
from country_codes.
I am actually doing it the same way it is done in the package README :
-
Use it on the first screen of the application. I use it in
didChangeDependencies
notinitState
because ofLocalizations
Inherited widget, but in thebuild
method the result is the same.
Here I think there is a mistake in plugin Readme, detailsForLocale
is a method defined in CountryCodes
not CountryDetails
class but its not that important. Also in Readme, there is Localization
instead if Localizations
, is that a typo too? Also Readme fragment for the reference.
from country_codes.
For some reason, iOS simulators don't have a default country set (this doesn't ever happen with real devices btw) and you'll need to go to settings > general > language & region > region > select one, even if it's already selected. After that you should be fine.
@miguelpruivo I was able to reproduce this one as well. It happens on iOS simulator when we request device-specific locale like this
final localeCodes = CountryCodes.detailsForLocale();
In such case setting region in the settings solves this particular problem but it is different than than the issue of this topic.
from country_codes.
Added default Locale
to en-US
on 1.0.1 whenever device hasn't one — although this is likely to only happen on iOS simulators.
from country_codes.
Related Issues (20)
- Typo in readme HOT 1
- Warning: Operand of null-aware operation '?.' has type 'NavigatorState' which excludes null.
- QUESTION: get dial code from isocountry HOT 6
- Gradle version incompatibility HOT 2
- List of all CountryDetails HOT 4
- My bad you can delete
- Country Code for Sint Maarten is wrong HOT 1
- DialCodeFormatter Not Working Anymore HOT 1
- Is Web supported? HOT 5
- Even after increasing the minSDkVersion to 21, App does not run HOT 1
- localizedName always returns null HOT 1
- Currency code and Symbol HOT 1
- Getting wrong dialCode.
- IOS archive failed HOT 2
- Gradle compatibility issue
- The list of country codes is using dynamics everywhere HOT 1
- Add Northern Ireland country code HOT 1
- getting error on build HOT 2
- Dissolution of Netherlands Antilles HOT 4
- Module 'country_codes' not found HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from country_codes.