{"id":15484629,"url":"https://github.com/thealphamerc/country_provider","last_synced_at":"2025-04-22T16:25:03.705Z","repository":{"id":53163907,"uuid":"267657535","full_name":"TheAlphamerc/country_provider","owner":"TheAlphamerc","description":"A flutter plugin to provide information about countries.","archived":false,"fork":false,"pushed_at":"2021-05-12T13:25:56.000Z","size":119,"stargazers_count":23,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T04:23:06.713Z","etag":null,"topics":["countries-api","countries-data","countries-json","country-provider","rest-countries"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/country_provider/","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheAlphamerc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-28T17:48:45.000Z","updated_at":"2024-01-15T17:36:27.000Z","dependencies_parsed_at":"2022-09-20T22:54:59.393Z","dependency_job_id":null,"html_url":"https://github.com/TheAlphamerc/country_provider","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlphamerc%2Fcountry_provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlphamerc%2Fcountry_provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlphamerc%2Fcountry_provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheAlphamerc%2Fcountry_provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheAlphamerc","download_url":"https://codeload.github.com/TheAlphamerc/country_provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250276010,"owners_count":21403788,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["countries-api","countries-data","countries-json","country-provider","rest-countries"],"created_at":"2024-10-02T05:41:28.814Z","updated_at":"2025-04-22T16:25:03.687Z","avatar_url":"https://github.com/TheAlphamerc.png","language":"Dart","funding_links":["https://www.buymeacoffee.com/thealphamerc","https://www.paypal.me/TheAlphamerc/"],"categories":[],"sub_categories":[],"readme":"# country_provider Flutter Plugin ![Twitter URL](https://img.shields.io/twitter/url?style=social\u0026url=https%3A%2F%2Ftwitter.com%2Fthealphamerc) [![GitHub stars](https://img.shields.io/github/stars/Thealphamerc/country_provider?style=social)](https://github.com/login?return_to=%2FTheAlphamerc%country_provider)  ![GitHub forks](https://img.shields.io/github/forks/TheAlphamerc/country_provider?style=social) \n\n[![pub package](https://img.shields.io/pub/v/country_provider?color=blue)](https://pub.dev/packages/country_provider)  ![GitHub last commit](https://img.shields.io/github/last-commit/Thealphamerc/country_provider) ![GitHub pull requests](https://img.shields.io/github/issues-pr/TheAlphamerc/country_provider) ![GitHub closed pull requests](https://img.shields.io/github/issues-pr-closed/Thealphamerc/country_provider)   ![GitHub issues](https://img.shields.io/github/issues-raw/Thealphamerc/country_provider) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/thealphamerc/country_provider) [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/Thealphamerc/country_provider) \n\n\nCountry Provider is a flutter library wrapper around the API provided by REST Countries https://restcountries.eu (Get information about countries via a RESTful API)\n\n\n## Download App ![GitHub All Releases](https://img.shields.io/github/downloads/Thealphamerc/country_provider/total?color=green)\n\u003ca href=\"https://github.com/TheAlphamerc/country_provider/releases/download/v1.0.1/app-release.apk\"\u003e\u003cimg src=\"https://playerzon.com/asset/download.png\" width=\"200\"\u003e\u003c/img\u003e\u003c/a\u003e\n\n## Getting Started\n### 1. Add library to your pubspec.yaml\n\n```yaml\n\ndependencies:\n  country_provider: ^0.0.2\n\n```\n\n### 2. Import library in dart file\n\n```dart\nimport 'package:country_provider/country_provider.dart';\n```\n\n## Note\n\nEach method return a `List` of [`Country`](https://github.com/TheAlphamerc/country_provider/blob/master/lib/src/models/country.dart).\n\n## Usage\n\n- Get all countries.\n\n```dart\n// Get all countries\nList\u003cCountry\u003e? countries = await CountryProvider.getAllCountries();\n```\n\n- Search by country name. It can be the native name or partial name.\n\n```dart\n// Search by country name\nList\u003cCountry\u003e? result = await CountryProvider.getCountriesByName(\"Ameri\");\n```\n\nIf partial name, this method could return a list of countries. Else a List of one element.\n\n- Search by country full name.\n\n```dart\n// Search by country full name\nCountry result = await CountryProvider.getCountryByFullname(\"India\")?.first;\n```\n\n-  Search by ISO 3166-1 2-letter or 3-letter country code.\n\n```dart\n// Search by list of ISO 3166-1 2-letter or 3-letter country codes\nCountry result = await CountryProvider.getCountryByCode(\"Ind\")?.first;\n```\n\n-  Search by list of ISO 3166-1 2-letter or 3-letter country codes.\n\n```dart\n// Search by list of ISO 3166-1 2-letter or 3-letter country codes\nList\u003cCountry\u003e? result =await CountryProvider.getCountriesByListOfCodes([\"Ind\", \"col\", \"ru\"]);\n```\n\n- Search by ISO 4217 currency code.\n\n```dart\n// Search by ISO 4217 currency code\nList\u003cCountry\u003e? result = await CountryProvider.getCountryByCurrencyCode(\"Inr\")\n```\n\n- Search by ISO 639-1 language code.\n\n```dart\n// Search by ISO 639-1 language code\nList\u003cCountry\u003e? result = await CountryProvider.getCountriesByLanguageCode([\"Hin\",\"en\",]);\n```\n\n-  Search by capital city.\n\n```csharp\n// Search by capital city\nvar result = await CountryProvider.getCountryByCapitalCity(\"Delhi\");\n```\n\nYou can use `var` instead of explicit types. I use explicit types to show you the return type of each method.\n\n- Search by calling code.\n\n```dart\n// Search by calling code\nList\u003cCountry\u003e? result = await CountryProvider.getCountryByCallingCode(91);\n```\n\n-  Search by continent: Africa, Americas, Asia, Europe, Oceania.\n\n```dart\n//  Search by continent: Africa, Americas, Asia, Europe, Oceania\nList\u003cCountry\u003e? result = await CountryProvider.getcountryByRegionalBloc(\"Asia\");\n```\n\n- Search by regional bloc: EU, EFTA, CARICOM, AU, USAN, EEU, AL, ASEAN , CAIS, CEFTA , NAFTA , SAARC.\n\n```dart\n//  Search by regional bloc\nList\u003cCountry\u003e? result = await CountryProvider.getCountriesByContinent(\"ASEAN\");\n```\n\n**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).\n\n## Apply filters\n\nTo get filtered country data pass [CountryFilter](https://github.com/TheAlphamerc/country_provider/blob/master/lib/src/models/countryFilter.dart) model as argument in search countries method.\n\n```dart\n// Get all countries name only \nvar countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true));\nList\u003cString\u003e countriesInSpanish = countries.map((e) =\u003e e.name).toList();\n\n// Get all countries name only in Spanish\nvar countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true));\nList\u003cString\u003e countriesInSpanish = countries.map((e) =\u003e e.translations.es).toList();\n\n// Get Europe countries in French language\nvar europeCountries = await CountryProvider.getcountryByRegionalBloc(\"Europe\",filter: CountryFilter(isName: true));\nList\u003cString\u003e europeCountriesInFrench = europeCountries.map((e) =\u003e e.translations.?fr).toList();\n\n// Get all countries name with their capital city only\nvar countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true,isCapital:true));\n\n// Get all countries name with country code and their capital city only\nvar countries = await CountryProvider.getAllCountries(filter: CountryFilter(isName: true,isCapital:true,isAlpha2Code:true,isAlpha3Code: true));\n\n\n// Feel free to aplly filters 🤓\n```\n\nDefault language for country name is English, but you can also get the name in other languages such as: `de`(German language),  `es`(Spanish language), `fr`(French language),  `ja`(Japanese language), `it`(Italian language), `br`(Breton language), `pt`(Portuguese language), `nl`(Dutch language), `hr`(Croatian language) and `fa`(Persian language).\n\n\n## Country class\n\n```dart\nclass Country\n{\t  \n    // Get Country name\n    String? name;\n\n    // Gets  Top Level Domain\n    List\u003cString\u003e? topLevelDomain;\n    \n    // Gets Alpha2 Code\n    String? alpha2Code;\n    \n    // Gets Alpha3 Code\n    String? alpha3Code;\n    \n    // Gets Calling Code\n    List\u003cString\u003e? callingCodes;\n    \n    // Gets Capital City\n    String? capital;\n    \n    // Get Alt Spelling\n    List\u003cString\u003e? altSpellings;\n    \n    // Get Region\n    String? region;\n    \n    // Get Sub region\n    String? subregion;\n    \n    // Get Population\n    int? population;\n    \n    // Get Latlng(Latitude and Longitude)\n    List\u003cdouble\u003e? latlng;\n    \n    // Get Demonym\n    String? demonym;\n    \n    // Get Area\n    double? area;\n    \n    // Get Gini\n    double? gini;\n    \n    // Get Timezone\n    List\u003cString\u003e? timezones;\n    \n    // Get Borders\n    List\u003cString\u003e? borders;\n    \n    // Get Native Name\n    String? nativeName;\n    \n    // Get Numeric Code\n    String? numericCode;\n    \n    // Get Currencies\n    List\u003cCurrency\u003e? currencies;\n    \n     // Get Languages\n    List\u003cLanguage\u003e? languages;\n    \n    // Gets Translations\n    Translations? translations;\n    \n    // Get Flag\n    String? flag;\n    \n    // Get Regional Blocs\n    List\u003cRegionalBloc\u003e? regionalBlocs;\n    \n    // Get  Cioc(International Olympic Committee Code)\n    String ?cioc;\n}\n```\n## CountryFilter Class \n``` dart\nclass CountryFilter{\n  bool isName;\n  bool isCapital;\n  bool isRegion;\n  bool isAlpha2Code;\n  bool isAlpha3Code;\n  bool isDemonym;\n  bool isTimeZone;\n  bool isCallingCode;\n  bool isBorders;\n  bool isAltSpellings;\n  bool isCurrency;\n  bool isLanguage;\n  bool isLatLong;\n  bool isTranslation;\n  bool isFlag;\n\n  CountryFilter({\n    this.isName = false,\n    this.isCapital = false,\n    this.isRegion = false,\n    this.isAlpha2Code = false,\n    this.isAlpha3Code = false,\n    this.isDemonym = false,\n    this.isTimeZone = false,\n    this.isCallingCode = false,\n    this.isBorders = false,\n    this.isAltSpellings = false,\n    this.isCurrency = false,\n    this.isLanguage = false,\n    this.isLatLong = false,\n    this.isTranslation = false,\n    this.isFlag = false,\n  });\n}\n```\n\n## Credits\n\nThanks to Fayder Florez for developing [REST Countries API](https://github.com/fayder/restcountries).\n\n\n## Other Flutter packages\n Name        | Stars        | Pub |\n:-------------------------|------------------------- | ------------------------- |\n|[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) |\n|[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) |\n|[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) |\n\n## Pull Requests\n\nI welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request.\n\n## Created \u0026 Maintained By\n\n[Sonu Sharma](https://github.com/TheAlphamerc) ([Twitter](https://www.twitter.com/TheAlphamerc)) ([Youtube](https://www.youtube.com/user/sonusharma045sonu/))\n([Insta](https://www.instagram.com/_sonu_sharma__))  ![Twitter Follow](https://img.shields.io/twitter/follow/thealphamerc?style=social)\n\n\u003e 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:\n\u003e\n\n\u003e * \u003ca href=\"https://www.buymeacoffee.com/thealphamerc\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" height=\"30\"\u003e\u003c/a\u003e\n\u003e * [PayPal](https://www.paypal.me/TheAlphamerc/)\n\n\n## Visitors Count\n\n\u003cimg align=\"left\" src = \"https://profile-counter.glitch.me/country_provider/count.svg\" alt =\"Loading\"\u003e\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealphamerc%2Fcountry_provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthealphamerc%2Fcountry_provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthealphamerc%2Fcountry_provider/lists"}