getLocationSuggestions static method
Future<List<String> >
getLocationSuggestions(
- Position position, {
- bool includeCurrentPosition = true,
Implementation
static Future<List<String>> getLocationSuggestions(Position position, {bool includeCurrentPosition = true}) async {
List<String> suggestions = await GeoLocatorController().getNearbySimpleAddresses(position);
if(includeCurrentPosition) {
Position? currentPosition = await GeoLocatorController().getCurrentPosition();
if(currentPosition != null) {
String currentAddress = await GeoLocatorController().getAddressSimple(currentPosition);
if(!suggestions.contains(currentAddress)) {
suggestions.add(currentAddress);
}
}
}
return suggestions;
}