DEV Community

Anurag Dhunna
Anurag Dhunna

Posted on

Answer: Flutter geolocator package not retrieving location

Apple doesn't allow multiple active calls to the location stream.

Solution:

Future<Position>? _positionFuture
Future<Position> getLocation() async {
  if (_positionFuture != null) {
    // If a future is already in progress, return it directly
    return _positionFuture!;
  } else {
    // If no future is in progress, start a new one

Top comments (0)