dart_mapbox_search

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.

pub package License

Developed with 💙 and maintained by scial.app

"Buy Me A Coffee"

Supported features

Feature API Endpoint Available
Get suggested results Search Box API /suggest :white_check_mark:
Retrieve a suggested feature Search Box API /retrieve :white_check_mark:
Get search results Search Box API /forward :white_check_mark:
Retrieve POIs by category Search Box API /category :white_check_mark:
Get category list Search Box API /list/category :white_check_mark:
Do a reverse lookup Search Box API /reverse :white_check_mark:
Forward geocoding with search text input Geocoding API /forward :white_check_mark:
Forward geocoding with structured input Geocoding API /forward :white_check_mark:
Reverse geocoding Geocoding API /reverse :white_check_mark:
Batch geocoding Geocoding API /batch :x:

Quick Start 🚀

Installation 🧑‍💻

In the dependencies section of your pubspec.yaml, add the following line:

dependencies:
  dart_mapbox_search: <latest_version>

Usage 👽

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.')
);

Contribution 💙

Always open for contribution! Contributors will be listed here.

Libraries