The geocoding library in Flutter provides several methods other than placemarkFromCoordinates for converting a location's coordinates into a human-readable address or location information:
placemarkFromAddress - This method takes a string representing an address and returns a list of Placemark objects that match the address.
placemarkFromQuery - This method takes a string representing a query and returns a list of Placemark objects that match the query. The query can be any text that describes a location, such as a landmark, an address, or a city name.
locationFromAddress - This method takes a string representing an address and returns a Location object containing the latitude and longitude of the address.
locationFromQuery - This method takes a string representing a query and returns a Location object containing the latitude and longitude of the location that matches the query.
placesNearby - This method takes a Location object and a radius in meters and returns a list of Place objects that are within the specified radius of the location.
placesAutocomplete - This method takes a string representing a query and returns a list of AutocompletePrediction objects that match the query. The predictions can be used to provide autocomplete suggestions for a location search.
Here are code examples to help:
// Get placemark from address
final addresses = await placemarkFromAddress('1600 Amphitheatre Parkway, Mountain View, CA');
final selectedAddress = addresses.first;
print(selectedAddress);
// Get location from query
final location = await locationFromQuery('Central Park, New York, NY');
print(location.latitude);
print(location.longitude);
// Get places nearby
final places = await placesNearby(Location(40.748817, -73.985428), 1000);
places.forEach((place) {
print(place.name);
});
// Get autocomplete predictions
final predictions = await placesAutocomplete('Times Square');
predictions.forEach((prediction) {
print(prediction.description);
});