I made this package because google place search was not working that much efficiently(daily quota limit) and MapBox offers plenty of free search requests.
Add the following to your pubspec.yaml
file:
dependencies:
mapbox_search: any
MapBoxStaticImage staticImage = MapBoxStaticImage(
apiKey:
"API Key");
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);
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,
);
String getStaticImageWithoutMarker() => staticImage.getStaticUrlWithoutMarker(
center: Location(lat: 37.75965, lng: -122.42816),
height: 300,
width: 600,
zoomLevel: 16,
style: MapBoxStyle.Mapbox_Outdoors,
render2x: true,
);
MapBoxPlaceSearchWidget(
popOnSelect: true,
apiKey:
"API KEY",
limit: 10,
searchHint: 'Your Hint here',
onSelected: (place) {},
context: context,
)
var reverseGeoCoding = ReverseGeoCoding(
apiKey: 'API Key',
limit: 5,
);
Future<List<MapBoxPlace>> getPlaces() =>
reverseGeoCoding.getAddress(
Location(lat: 72.0, lng: 76.00),
);
var placesSearch = PlacesSearch(
apiKey: 'API Key',
limit: 5,
);
Future<List<MapBoxPlace>> getPlaces() =>
placesSearch.getPlaces("New York");