Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Flutter-Paket, das die Standort-Suchfunktion mit der MapBox-API ermöglicht und statische Kartenbilder generiert. Es vereinfacht die Integration von Geolocation-Funktionen in Flutter-Apps durch eine einfache Schnittstelle zum Suchen von Orten, Abrufen von Koordinaten und Anzeigen statischer Karten. Ideal für Anwendungen, die Adressensuche, Standortauswahl oder Kartenvorschauen erfordern. Das Paket unterstützt mehrere Plattformen wie Android, iOS, Web, macOS, Windows und Linux und gewährleistet breite Kompatibilität. Entwickler können ortsbasierte Dienste mit minimalem Aufwand implementieren.
Anwendungsfälle
Standort-Suche in mobilen Apps
Adressenauswahl für Formulare
Statische Kartenvorschauen
Geokodierungsintegration
Kartenbasierte Benutzeroberflächenkomponenten
Reise- und Lieferungs-Apps
Hauptmerkmale
MapBox-API-Integration
Generierung statischer Kartenbilder
Plattformübergreifende Unterstützung
Einfache Suchoberfläche
Koordinatenabruf
reaktives Design
Geeignet für
Entwickler von ortsbasierten Anwendungen
Apps, die Adressensuche benötigen
Projekte, die statische Karten erfordern
Plattformübergreifende mobile und Web-Anwendungen
Reise-, Logistik- und Kartierungstools
Hinweise
Benötigt MapBox-API-Schlüssel
Netzwerkverbindung erforderlich
Mögliche Rate-Limits auf der kostenlosen Ebene
Beschränkte Anpassung der Suchbenutzeroberfläche
Abhängig von der Stabilität der externen API
Zusätzliche Konfiguration für jede Plattform
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
About
Note: Breaking Changes in 4.x.x
PlaceSearch and ReverseGeoCoding classes are now merged into one class called GeoCoding with two methods getPlaces and getAddress since both of them are using the same API.
Instead of throwing exceptions, the package now returns ApiResponse Record which can be either Success or Failure and can be handled using fold method.
Location class is now converted to a record.
List of coordinates are now converted to a record (lat: double, long: doube) whereever possible.
This package provides easy api calls to MapBox Search API.
As this package doesn't depend on Flutter SDK you cannot use the Colors class anymore on you Flutter project.
Instead use map_box_search's Color.rgb constructor, passing the values as parameters:
var myColor = Colors.redAccent; //Flutter's Color classvar mapBoxColor = Color.rgb( myColor.red, myColor.green, myColor.blue);
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
Setup
Now you can setup the API key for whole app by calling MapBoxSearch.init('API KEY') in your main() function, this way you don't have to pass the API key to every class that uses the package.
Usage of ApiResponse
finalApiResponse<List<MapBoxPlace>> addresses = awaitgetAddress();
addresses.fold(
(success) => // Do something with success data,
(failure) => // Do something with failure data,
);
Examples
SearchBox API
SearchBoxAPI search = SearchBoxAPI(
apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')
limit: 6,
);
var reverseGeoCoding = GeoCoding(
apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')
limit: 5,
);
Future<ApiResponse<List<MapBoxPlace>>> getAddress() =>
reverseGeoCoding.getAddress(
Location(lat: 72.0, lng: 76.00),
);
Forward GeoCoding Seach
var geocoding = GeoCoding(
apiKey: 'API Key', // dont pass if you have set it in MapBoxSearch.init('API KEY')
country: "BR",
limit: 5,
types: [PlaceType.address, PlaceType.place],
);
Future<ApiResponse<List<MapBoxPlace>>> getPlaces() =>
geocoding.getPlaces(
"central park",
proximity: Location(
lat: -19.984634,
lng: -43.9502958,
),
);
Batch Geocoding (v6)
Perform multiple geocoding queries (forward, reverse, or structured) in a single request.