Mapbox Search made easy! 💎
A Dart package for interacting with the Mapbox Search Box and Geocoding APIs. It provides a set of utilities and models to facilitate integration with Mapbox's powerful search capabilities.
Developed with 💙 and maintained by scial.app
Feature | API | Endpoint | Available |
---|---|---|---|
Get suggested results | Search Box API | /suggest | ✅ |
Retrieve a suggested feature | Search Box API | /retrieve | ✅ |
Get search results | Search Box API | /forward | ✅ |
Retrieve POIs by category | Search Box API | /category | ✅ |
Get category list | Search Box API | /list/category | ✅ |
Do a reverse lookup | Search Box API | /reverse | ✅ |
Forward geocoding with search text input | Geocoding API | /forward | ✅ |
Forward geocoding with structured input | Geocoding API | /forward | ✅ |
Reverse geocoding | Geocoding API | /reverse | ✅ |
Batch geocoding | Geocoding API | /batch | ❌ |
In the dependencies
section of your pubspec.yaml
, add the following line:
dependencies:
dart_mapbox_search: <latest_version>
Import the package:
import 'package:dart_mapbox_search/dart_mapbox_search.dart';
Create an instance:
late final MapboxSearchClient mapboxSearch;
void main() async {
final MapboxSearch result = MapboxSearch.initialize(accessToken: '...');
mapboxSearch = result.client;
}
Make use of one of the many methods provided by this package e.g.:
final MapboxSearchResult<MapboxSearchSuggestResponse> response = await mapboxSearch.search.suggest('scial Headquarter');
response.fold(
onSuccess: (MapboxSearchSuggestResponse data) => print('Data found!'),
onFailure: (int statusCode, String? message, String? error) => print('Error occured.')
);
Always open for contribution! Contributors will be listed here.