Created
May 30, 2020 09:45
-
-
Save sbis04/ee582351a51df5451c277bbb9ce44c68 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 current location | |
_getCurrentLocation() async { | |
await _geolocator | |
.getCurrentPosition(desiredAccuracy: LocationAccuracy.high) | |
.then((Position position) async { | |
setState(() { | |
// Store the position in the variable | |
_currentPosition = position; | |
print('CURRENT POS: $_currentPosition'); | |
// For moving the camera to current location | |
mapController.animateCamera( | |
CameraUpdate.newCameraPosition( | |
CameraPosition( | |
target: LatLng(position.latitude, position.longitude), | |
zoom: 18.0, | |
), | |
), | |
); | |
}); | |
}).catchError((e) { | |
print(e); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment