{"id":17595349,"url":"https://github.com/anasfik/moroccan_cities","last_synced_at":"2025-07-10T16:09:48.908Z","repository":{"id":158213667,"uuid":"633903254","full_name":"anasfik/moroccan_cities","owner":"anasfik","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-28T14:47:02.000Z","size":15,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-30T18:52:45.875Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/anasfik.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-28T14:45:57.000Z","updated_at":"2023-04-28T14:46:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"e19e1745-3216-423a-b91f-f129a698f3a7","html_url":"https://github.com/anasfik/moroccan_cities","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anasfik/moroccan_cities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fmoroccan_cities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fmoroccan_cities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fmoroccan_cities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fmoroccan_cities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anasfik","download_url":"https://codeload.github.com/anasfik/moroccan_cities/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anasfik%2Fmoroccan_cities/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264605013,"owners_count":23635985,"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":[],"created_at":"2024-10-22T07:54:44.829Z","updated_at":"2025-07-10T16:09:48.888Z","avatar_url":"https://github.com/anasfik.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Moroccan cities utility for Dart/Flutter\n\nThis package represents a utility package for accessing the data of all cities \u0026 regions in Morocco, so you can have the option to use it in your app directly without having to search for it or loading it from a remote source via an http request as an example.\n\n\u003cbr\u003e\n## Why this package?\n\n - This package doesn't require you to load the data from a remote source, so you can use it directly in your app without having to wait for a network request to finish.\n\n - This package offers both `Future` and `Stream` functionalities for getting all data resources, so you can get items as they are ready and listen to them via a `StreamBuilder`... or you can wait until all resources are ready and use it with a `FutureBuilder`...\n\n - The computation happening for loading and modeling the data in this package happens in a separate `Isolate`, so you can guarantee a seamless and smooth experience in your Flutter app UI.\n\n\u003cbr\u003e\n\n## Usage\n#### Cities\n\nFor getting all Morocco cities as a `Stream\u003cMorrocanCity\u003e`:\n```dart\nStream\u003cMorrocanCity\u003e citiesStream = MoroccanCities.instance.citiesStream();\n\ncitiesStream.listen((city) {\n   print(city.name); // ...\n});\n\n```\n\nFor getting all Morocco cities as a final `List\u003cMorrocanCity\u003e`:\n```dart\nList\u003cMorrocanCity\u003e cities = await MoroccanCities.instance.cities();\nprint(cities); // ...\nprint(cities.first.name); // ...\n```\n\n\u003cbr\u003e\n\n#### Regions\nFor getting all Morocco regions as a `Stream\u003cMorrocanRegion\u003e`:\n```dart\nStream\u003cMorrocanRegion\u003e regionsStream = MoroccanCities.instance.regionsStream();\n\nregionsStream.listen((region) {\n   print(region.name); // ...\n});\n\n```\n\n\nFor getting all Morocco regions as a final `List\u003cMorrocanRegion\u003e`:\n```dart\nList\u003cMorrocanRegion\u003e regions = await MoroccanCities.instance.regions();\nprint(regions); // ...\nprint(regions.first.name); // ...\n```\n\n\n\u003cbr\u003e\n\n#### Cities by region\nFor getting all Morocco cities by region as a `Stream\u003cMorrocanCity\u003e`:\n```dart\nfinal regions = await MoroccanCities.instance.regions();\nStream\u003cMorrocanCity\u003e citiesByRegionStream = MoroccanCities.instance.citiesByRegionStream(regions.first);\n\ncitiesByRegionStream.listen((city) {\n   print(city.name); // ...\n});\n\n```\n\nFor getting all Morocco cities by region as a final `List\u003cMorrocanCity\u003e`:\n```dart\nfinal regions = await MoroccanCities.instance.regions();\nList\u003cMorrocanCity\u003e citiesByRegion = await MoroccanCities.instance.citiesByRegion(regions.first);\nprint(citiesByRegion); // ...\nprint(citiesByRegion.first.name); // ...\n```\n\n\u003cbr\u003e\n\n#### Contributing\nIf you want to contribute to this package, you can do so by creating a pull request and I'll be happy to review it and merge it if it's good to go, this package is made to offer help for moroccan developers who want to use it in their apps, so any contribution is welcome.\n\n\u003cbr\u003e\n\n#### License\nThis package is licensed under the MIT license, so you can use it in your apps without any restrictions.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanasfik%2Fmoroccan_cities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanasfik%2Fmoroccan_cities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanasfik%2Fmoroccan_cities/lists"}