getCurrentPosition method

  1. @override
Future<Position> getCurrentPosition({
  1. LocationSettings? locationSettings,
})
override

Implementation

@override
Future<Position> getCurrentPosition({
  LocationSettings? locationSettings,
}) async {
  try {
    final result = await methodChannel.invokeMapMethod<String, dynamic>(
      'getCurrentPosition',
      locationSettings?.toJson() ?? const <String, dynamic>{},
    );
    if (result == null) {
      throw PositionUpdateException('Platform returned no position');
    }
    return Position.fromMap(result);
  } on PlatformException catch (e) {
    throw _mapException(e);
  }
}