mapbox_search 4.2.2 copy "mapbox_search: ^4.2.2" to clipboard
mapbox_search: ^4.2.2 copied to clipboard

A Flutter package for place search using MapBox Api and for Static map image

example/main.dart

import 'dart:core';

import 'package:mapbox_search/mapbox_search.dart';

// import 'credentials.dart';
final MAPBOX_KEY = '';

Future<void> main() async {
  final apiKey = MAPBOX_KEY; //Set up a test api key before running
  MapBoxSearch.init(apiKey);

  await geoCoding(apiKey).catchError(print);
  await placesSearch(apiKey).catchError(print);
}

///Reverse GeoCoding sample call
Future geoCoding(String apiKey) async {
  var geoCodingService = GeoCoding(
    country: "BR",
    limit: 5,
  );

  var addresses = await geoCodingService.getAddress((
    lat: -19.984846,
    long: -43.946852,
  ));

  addresses.fold(
    (success) => print(success),
    (failure) => print(failure),
  );

  print(addresses.success);
}

///Places search sample call
Future placesSearch(String apiKey) async {
  var placesService = GeoCoding(
    apiKey: apiKey,
    country: "BR",
    limit: 5,
  );

  var places = await placesService.getPlaces(
    "patio",
    proximity: Proximity.LatLong(
      lat: -19.984634,
      long: -43.9502958,
    ),
  );

  print(places);
}
87
likes
140
pub points
95%
popularity

Publisher

verified publisherketanchoyal.dev

A Flutter package for place search using MapBox Api and for Static map image

Repository (GitHub)
View/report issues
Contributing

Documentation

API reference

License

MIT (license)

Dependencies

color, http, json_annotation, uuid

More

Packages that depend on mapbox_search