getCurrentGeolocationPosition method
Implementation
Future<GeolocationPosition> getCurrentGeolocationPosition({
bool enableHighAccuracy = true,
Duration timeout = const Duration(seconds: 15),
Duration maximumAge = const Duration(minutes: 5),
}) {
var completer = Completer<GeolocationPosition>();
getCurrentPosition(
(GeolocationPosition geoPos) {
completer.completeSafe(geoPos);
}.toJS,
(GeolocationPositionError geoPosError) {
completer.completeErrorSafe(geoPosError);
}.toJS,
PositionOptions(
enableHighAccuracy: enableHighAccuracy,
timeout: timeout.inMilliseconds,
maximumAge: maximumAge.inMilliseconds),
);
return completer.future;
}