-
-
Save sbis04/87b855a5d459dd69ee2c67faea8fa8f0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method for retrieving the address | |
_getAddress() async { | |
try { | |
// Places are retrieved using the coordinates | |
List<Placemark> p = await _geolocator.placemarkFromCoordinates( | |
_currentPosition.latitude, _currentPosition.longitude); | |
// Taking the most probable result | |
Placemark place = p[0]; | |
setState(() { | |
// Structuring the address | |
_currentAddress = | |
"${place.name}, ${place.locality}, ${place.postalCode}, ${place.country}"; | |
// Update the text of the TextField | |
startAddressController.text = _currentAddress; | |
// Setting the user's present location as the starting address | |
_startAddress = _currentAddress; | |
}); | |
} catch (e) { | |
print(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment