{"id":15066456,"url":"https://github.com/ketanchoyal/mapbox_search","last_synced_at":"2025-04-04T10:06:09.442Z","repository":{"id":45331794,"uuid":"204442195","full_name":"ketanchoyal/mapbox_search","owner":"ketanchoyal","description":"A Flutter package for place search using MapBox Api and for Static map image","archived":false,"fork":false,"pushed_at":"2025-02-12T19:09:05.000Z","size":1372,"stargazers_count":73,"open_issues_count":1,"forks_count":60,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T09:05:37.038Z","etag":null,"topics":["dart","dartlang","flutter","flutter-package","hacktoberfest","mapbox-api"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/mapbox_search","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/ketanchoyal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"github":["ketanchoyal"],"issuehunt":"ketanchoyal","custom":["https://www.paypal.me/ketanchoyal/"]}},"created_at":"2019-08-26T09:29:31.000Z","updated_at":"2025-02-12T19:10:18.000Z","dependencies_parsed_at":"2024-01-31T17:14:53.052Z","dependency_job_id":"97b7fd2e-0c48-4dfa-a79e-74a2d5cfa66b","html_url":"https://github.com/ketanchoyal/mapbox_search","commit_stats":{"total_commits":91,"total_committers":13,"mean_commits":7.0,"dds":0.7032967032967032,"last_synced_commit":"5cd7c3fe34191d513a6e9fc393a6fb645999c4f0"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketanchoyal%2Fmapbox_search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketanchoyal%2Fmapbox_search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketanchoyal%2Fmapbox_search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ketanchoyal%2Fmapbox_search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ketanchoyal","download_url":"https://codeload.github.com/ketanchoyal/mapbox_search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247157047,"owners_count":20893202,"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":["dart","dartlang","flutter","flutter-package","hacktoberfest","mapbox-api"],"created_at":"2024-09-25T01:08:12.936Z","updated_at":"2025-04-04T10:06:09.417Z","avatar_url":"https://github.com/ketanchoyal.png","language":"Dart","funding_links":["https://github.com/sponsors/ketanchoyal","https://issuehunt.io/r/ketanchoyal","https://www.paypal.me/ketanchoyal/"],"categories":[],"sub_categories":[],"readme":"[![Pub](https://img.shields.io/pub/v/mapbox_search)](https://pub.dev/packages/mapbox_search) \n# About\n\n## Note: Breaking Changes in 4.x.x\n\n- PlaceSearch and ReverseGeoCoding classes are now merged into one class called GeoCoding with two methods `getPlaces` and `getAddress` since both of them are using the same API.\n- MapBox's new [SearchBox API](https://docs.mapbox.com/api/search/search-box/) is added to the package.\n- Instead of throwing exceptions, the package now returns `ApiResponse` Record which can be either `Success` or `Failure` and can be handled using `fold` method.\n- Location class is now converted to a record.\n- List of coordinates are now converted to a record `(lat: double, long: doube)` whereever possible.\n\nThis package provides easy api calls to MapBox Search API. \n\nAlso, it contains an static map image generator.\n\n[Maki Icons](https://labs.mapbox.com/maki-icons/) can be used now in marker icon\n\nAs this package doesn't depend on Flutter SDK you cannot use the `Colors` class anymore on you Flutter project.\nInstead use map_box_search's `Color.rgb` constructor, passing the values as parameters:\n\n```dart\nvar myColor = Colors.redAccent; //Flutter's Color class\nvar mapBoxColor = Color.rgb( myColor.red, myColor.green, myColor.blue);\n```\n\n## Installing\n\nFirst of all you must acquire an API key on the MapBox website https://www.mapbox.com/\n\nThen, add the following to your `pubspec.yaml` file:\n\n    dependencies:\n      mapbox_search: any\n\n## Setup\n Now you can setup the API key for whole app by calling `MapBoxSearch.init('API KEY')` in your `main()` function, this way you don't have to pass the API key to every class that uses the package.\n\n### Usage of `ApiResponse`\n```dart\nfinal ApiResponse\u003cList\u003cMapBoxPlace\u003e\u003e addresses = await getAddress();\naddresses.fold(\n    (success) =\u003e // Do something with success data,\n    (failure) =\u003e // Do something with failure data,\n  );\n```\n\n# Examples\n\n### SearchBox API\n```dart\nSearchBoxAPI search = SearchBoxAPI(\n      apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')\n      limit: 6,\n);\n```\n  ##### Get Suggestions\n  ```dart\n  ApiResponse\u003cSuggestionResponse\u003e searchPlace = await search.getSuggestions(\n      \"central\",\n    );\n  ```\n\n  ##### Get mapbox_id\n  - From SuggestionResponse\n  ```dart\n  String mapboxId = searchPlace.suggestions[0].mapboxId;\n  ```\n\n  ##### Get Place Details\n  ```dart\n  ApiResponse\u003cRetrieveResonse\u003e searchPlace = await search.getPlace(mapboxId);\n  ```\n\n\n\n### Reverse GeoCoding\n```dart\nvar reverseGeoCoding = GeoCoding(\n    apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')\n    limit: 5,\n);\n\nFuture\u003cApiResponse\u003cList\u003cMapBoxPlace\u003e\u003e\u003e getAddress() =\u003e\n  reverseGeoCoding.getAddress(\n    Location(lat: 72.0, lng: 76.00),\n);\n```\n\n\n\n### Forward GeoCoding Seach\n```dart\nvar geocoding = GeoCoding(\n    apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')\n    country: \"BR\",\n    limit: 5,\n    types: [PlaceType.address, PlaceType.place],\n);\n\nFuture\u003cApiResponse\u003cList\u003cMapBoxPlace\u003e\u003e\u003e getPlaces() =\u003e\n  geocoding.getPlaces(\n      \"central park\",\n      proximity: Location(\n        lat: -19.984634,\n        lng: -43.9502958,\n      ),\n    );\n```\n\n### Static Image\n```dart\nMapBoxStaticImage staticImage = MapBoxStaticImage(\n    apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')\n  );\n```\n\n### Image With Polyline\n```dart\n    String getStaticImageWithPolyline() =\u003e staticImage.getStaticUrlWithPolyline(\n      point1: Location(lat: 37.77343, lng: -122.46589),\n      point2: Location(lat: 37.75965, lng: -122.42816),\n      marker1: MapBoxMarker( markerColor: Colors.black, \n      markerLetter: MakiIcons.aerialway.value, \n      markerSize: MarkerSize.LARGE),\n      marker2: MapBoxMarker(\n          markerColor: Color.rgb(244, 67, 54),\n          markerLetter: 'q',\n          markerSize: MarkerSize.SMALL),\n      height: 300,\n      width: 600,\n      zoomLevel: 16,\n      style: MapBoxStyle.Mapbox_Dark,\n      path: MapBoxPath(pathColor: Color.rgb(255, 0, 0), pathOpacity: 0.5,     pathWidth: 5),\n      render2x: true);\n``` \n\n### Image with Marker\n```dart\nString getStaticImageWithMarker() =\u003e staticImage.getStaticUrlWithMarker(\n  center: Location(lat: 37.77343, lng: -122.46589),\n  marker: MapBoxMarker(\n      markerColor: Color.rgb(0, 0, 0), markerLetter: 'p', markerSize: MarkerSize.LARGE),\n  height: 300,\n  width: 600,\n  zoomLevel: 16,\n  style: MapBoxStyle.Mapbox_Streets,\n  render2x: true,\n);\n```\n\n### Image without Marker\n```dart\nString getStaticImageWithoutMarker() =\u003e staticImage.getStaticUrlWithoutMarker(\n    center: Location(lat: 37.75965, lng: -122.42816),\n    height: 300,\n    width: 600,\n    zoomLevel: 16,\n    style: MapBoxStyle.Mapbox_Outdoors,\n    render2x: true,\n  );\n```\n# Screenshots\n\n## Static Map Image\n\n\u003cimg src=\"https://github.com/ketanchoyal/mapbox_search/raw/dev/Screenshots/staticImages.png\" alt=\"Static Map Image\"/\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fketanchoyal%2Fmapbox_search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fketanchoyal%2Fmapbox_search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fketanchoyal%2Fmapbox_search/lists"}