getCurrentPosition function

Future<LatLng?> getCurrentPosition()

Returns current LatLng of the device without checking for permissions. Use this function when it is known that location permission is enabled.

Implementation

Future<LatLng?> getCurrentPosition() async {
  final _logger = AtSignLogger('getCurrentPosition');

  try {
    var position = await Geolocator.getCurrentPosition();
    return LatLng(position.latitude, position.longitude);
  } catch (e) {
    _logger.severe('$e');
    return null;
  }
}