getCurrentLocation method
Future<LocationData>
getCurrentLocation({
- LocationAccuracy accuracy = LocationAccuracy.high,
override
Returns the current location as a single shot.
Implementation
@override
Future<LocationData> getCurrentLocation({
LocationAccuracy accuracy = LocationAccuracy.high,
}) async {
final result = await methodChannel.invokeMethod<Map>(
'getCurrentLocation',
{'accuracy': accuracy.index},
);
if (result == null) {
throw PlatformException(
code: 'LOCATION_ERROR',
message: 'Failed to get current location',
);
}
return LocationData.fromMap(Map<String, dynamic>.from(result));
}