mapbox_search 2.0.0-dev.1.0.1 copy "mapbox_search: ^2.0.0-dev.1.0.1" to clipboard
mapbox_search: ^2.0.0-dev.1.0.1 copied to clipboard

outdated

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

Pub

About #

This package provides easy api calls to MapBox Search API.

Also, it contains an static map image generator 😆.

#Migration to 2.0 Before 2.0 this library depended on Flutter SDK, preventing its usage on other platforms such as a backend, CLI apps, Dart2Javascript, etc...

Now all the Flutter related code, such as the MapBoxSearchWidget was moved to a separated library, here: mapbox_search_flutter

Installing #

First of all you must acquire an API key on the MapBox website https://www.mapbox.com/

Then, add the following to your pubspec.yaml file:

dependencies:
  mapbox_search: any

Example #

Reverse GeoCoding #

var reverseGeoCoding = ReverseGeoCoding(
    apiKey: 'API Key',
    limit: 5,
);

Future<List<MapBoxPlace>> getPlaces() =>
  reverseGeoCoding.getAddress(
    Location(lat: 72.0, lng: 76.00),
);

Places Seach #

var placesSearch = PlacesSearch(
    apiKey: 'API Key',
    limit: 5,
);

Future<List<MapBoxPlace>> getPlaces() =>
  placesSearch.getPlaces("New York");

Static Image #

MapBoxStaticImage staticImage = MapBoxStaticImage(
    apiKey:
        "API Key");

Image With Polyline #

String getStaticImageWithPolyline() => staticImage.getStaticUrlWithPolyline(
  point1: Location(lat: 37.77343, lng: -122.46589),
  point2: Location(lat: 37.75965, lng: -122.42816),
  marker1: MapBoxMarker( markerColor: Colors.black, markerLetter: 'p', markerSize: MarkerSize.LARGE),
  msrker2: MapBoxMarker(
      markerColor: Colors.redAccent,
      markerLetter: 'q',
      markerSize: MarkerSize.SMALL),
  height: 300,
  width: 600,
  zoomLevel: 16,
  style: MapBoxStyle.Mapbox_Dark,
  path: MapBoxPath(pathColor: Colors.red, pathOpacity: 0.5,     pathWidth: 5),
  render2x: true);

Image with Marker #

String getStaticImageWithMarker() => staticImage.getStaticUrlWithMarker(
  center: Location(lat: 37.77343, lng: -122.46589),
  marker: MapBoxMarker(
      markerColor: Colors.black, markerLetter: 'p', markerSize: MarkerSize.LARGE),
  height: 300,
  width: 600,
  zoomLevel: 16,
  style: MapBoxStyle.Mapbox_Streets,
  render2x: true,
);

Image without Marker #

String getStaticImageWithoutMarker() => staticImage.getStaticUrlWithoutMarker(
    center: Location(lat: 37.75965, lng: -122.42816),
    height: 300,
    width: 600,
    zoomLevel: 16,
    style: MapBoxStyle.Mapbox_Outdoors,
    render2x: true,
  );

Screenshots #

Static Map Image #

Static Map Image

Search Widget #

Demo Demo
82
likes
0
pub points
95%
popularity

Publisher

verified publisherketanchoyal.dev

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

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

color, http

More

Packages that depend on mapbox_search