Code Monkey home page Code Monkey logo

country_codes's Introduction

Hi there πŸ‘‹

I'm Miguel, a passionate Mobile Developer currently mostly working with Flutter.

  • πŸ‘¨β€πŸ’» I'm a Mobile Engineer.
  • πŸ”­ I’m currently working at Hypnotic.
  • πŸ“– As an always learner, I'm curious to learn a bit of everything.
  • ⭐️ I collaborate to multiple portuguese recognized open-source projects.
  • πŸ’™ I enjoy creating and contributing to multiple Flutter plugins.
  • πŸ“« How to reach me: Email
  • πŸ˜„ Pronouns: He/His
  • 🀫 Fun fact: my favorite languages are system level ones (such as C and C++), however, I hardly work with them on my daily basis.

Languages and Tools:

profile for Miguel Ruivo at Stack Overflow, Q&A for professional and enthusiast programmers

Mu github stats

country_codes's People

Contributors

antonyleons avatar bishalstha avatar csejrup avatar kyle-seongwoo-jun avatar lmordell avatar miguelpruivo avatar vegardan avatar wenxiangjiang avatar wizlif avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

country_codes's Issues

QUESTION: get dial code from isocountry

Hello, how i can setup a locale for an isocountry to get the respective dial code?
for example for USA or any other country

final CountryDetails details = CountryCodes.detailsForLocale("US");

print(details.dialCode); // Displays the dial code for US, +1.

thanks for your help!

Even after increasing the minSDkVersion to 21, App does not run

Throwing below error. Please help me with it

Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
/Users/shaileshmishra/Desktop/currency_converter/android/app/src/debug/AndroidManifest.xml Error:
uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:country_codes] /Users/shaileshmishra/Desktop/currency_converter/build/country_codes/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.miguelruivo.flutter.plugin.countrycodes.country_codes" to force usage (may lead to runtime failures)

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugMainManifest'.

Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 21 declared in library [:country_codes] /Users/shaileshmishra/Desktop/currency_converter/build/country_codes/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 16
Suggestion: use a compatible library with a minSdk of at most 16,
or increase this project's minSdk version to at least 21,
or use tools:overrideLibrary="com.miguelruivo.flutter.plugin.countrycodes.country_codes" to force usage (may lead to runtime failures)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3s
Running Gradle task 'assembleDebug'... 4.2s

The plugin country_codes requires a higher Android SDK version.
Fix this issue by adding the following to the file /Users/shaileshmishra/Desktop/currency_converter/android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 21
}
}

Typo in readme

There is a typo in readme,

final CountryDetails details = CountryDetails.detailsForLocale();

This should be:

final CountryDetails details = CountryCodes.detailsForLocale();

Error in CountryCodes#detailsFromAlpha2

The implementation of CountryCodes#detailsFromAlpha2 is missing the localizedCountryName parameter to the CountryDetails#fromMap call.

Current version:

  static CountryDetails detailsFromAlpha2(String alpha2) {
    return CountryDetails.fromMap(codes.entries.where((entry) => entry.key == alpha2).single.value);
  }

but should probably be something like:

  static CountryDetails detailsFromAlpha2(String alpha2) {
    var codeEntry = codes.entries.where((entry) => entry.key == alpha2).single;
    return CountryDetails.fromMap(codeEntry.value, _localizedCountryNames[codeEntry.key]);
  }

Getting wrong dialCode.

I'm getting wrong dialCode. Right now my location is India but I'm getting the US dialCode. So I need to add something else in my code or not!

Screenshot 2022-06-14 at 11 01 35 AM

So what can I do for getting current country dialCode?
Thanks

Library crashes when providing app-specific locale

Hello,

I am trying to get country code based on the locale of the application, here is how I am invoking the method:

    final localeCodes = CountryCodes.detailsForLocale(Localizations.localeOf(context));

Following throws this error:

image

This is caused because countryCode is an optional parameter in Locale and might be null, here is the locale constructor:
image

and here is how the locale is resolved in the library

image

DialCodeFormatter Not Working Anymore

Hi,

I wanted to use the DialCodeFormatter as shown in your example :
TextFormField( keyboardType: TextInputType.phone, inputFormatters: [DialCodeFormatter()], );
But it didn't work in my project. So I tried your example by cloning the repo, but it seems it didn't work anymore because I got this screen on the device :
image
Any solution to resolve this ?

Currency code and Symbol

Hello and great work,

It will be fantastic to have two more columns about currency code and relative symbol.

Thanks
Sam

IOS archive failed

Run flutter build ios --release ,
And in Xcode --> Product --> Archive .
Find error message Module 'country_codes' not found

getting error on build

Hi, I got this error when I try to build package

`A problem occurred evaluating root project 'country_codes'.

Failed to apply plugin [id 'com.android.library']
Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in D:\programer\flutter.pub-cache\hosted\pub.dartlang.org\country_codes-1.0.1\android\gradle\wrapper\gradle-wrapper.properties to gradle-5.4.1-all.zip`

localizedName always returns null

If I use the method CountryCodes.countryCodes() to receive a list of all country codes and I try to access the value of localizedName, I always get null.

I tried it initializing CountryCodes with either default options (device locale) and also US or DE locale.
Neither of them returned a value in localizedName.

Is this already known?

Alpha3Code is null

CountryCodes.countryCodes() return a list of CountryDetails. Alpha3Code property of CountryDetails is always null for any country.
Screen Shot 2024-05-13 at 14 49 48 PM

Gradle compatibility issue

com.android.builder.errors.EvalIssueException: The Android Gradle plugin supports only kotlin-android-extensions Gradle plugin version 1.6.20 and higher.
The following dependencies do not satisfy the required version:
project ':country_codes' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10

List of all CountryDetails

I would like to display all the countries to the user. Once user has selected a specific country, iso code will be used. How to get CountryDetails of all languages?

Gradle version incompatibility

When I try to build a Flutter release of my app, Flutter complains as follows:

Building plugin country_codes...
Running Gradle task 'assembleAarRelease'...                        490ms

FAILURE: Build failed with an exception.

* Where:
Build file '/home/stefan/xxxxxx/.cache/pub-cache/hosted/pub.dartlang.org/country_codes-2.0.0/android/build.gradle' line: 24

* What went wrong:
A problem occurred evaluating root project 'country_codes'.
> Failed to apply plugin [id 'com.android.library']
   > Minimum supported Gradle version is 5.4.1. Current version is 4.10.2. If using the gradle wrapper, try editing the distributionUrl in /home/stefan/xxxxxx/.cache/pub-cache/hosted/pub.dartlang.org/country_codes-2.0.0/android/gradle/wrapper/gradle-wrapper.properties to gradle-5.4.1-all.zip

Would you please upgrade gradle-wrapper.properties to the version mentioned in the error message and release a new version of your plugin? I would appreciate it very much.

I know, I can fix it by myself, but I think hacking downloaded files is not a good idea. Every time I delete my Dart pub cache, I have to reapply the fix.

Dissolution of Netherlands Antilles

Hello!

I was going through your codes.dart since I needed to get an up-to-date alpha 2 code and English country name Map for a project, and I noticed a couple things as I was verifying using iso.org, the biggest one being the dissolution of Netherlands Antilles in 2010, which led to the AN code being phased out in favor of BQ (Bonaire, Sint Eustatius and Saba), CW (Curaçao), and SX (Sint Maarten (Dutch part)). That last one ended up splitting the Saint Martin Island into French and Dutch parts, so that might also affect MF in that it may now have to be "Saint Martin (French part)".

I also noticed a couple of other little things:

  1. I didn't see EH (Western Sahara) listed, which makes sense since that whole area is in dispute, but it is still listed on iso.org, and many people still use it under ISO 3166-2, grandfathering it over from ISO 3166-1, so I am not sure if you may want to add it in?
  2. It looks like UM (United States Minor Outlying Islands) may be missing entirely, which might not be so great for people looking for an exhaustive list.
  3. XK (Kosovo) is technically not yet on iso.org, even though it is a generally accepted temporary country code, so I am not sure if you would like to keep it or wait to add it back when it is official?
  4. I think I caught a duplicate entry for Puerto Rico, one with its alpha 2 code misassigned to its alpha 3 code (see line 892).

Thank you for making this package--it has saved me hours of time, and I very much appreciate your hard work! I hope my feedback helps to make this already great repo even better :)

Disclaimer: I am not at all an expert in ISO codes. All my statements are based on my brief research from me trying to make sure I do this part of my project as correctly and accurately as possible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.