Answer: Flutter geolocator package not retrieving location

anuragdhunna

Anurag Dhunna

Posted on June 20, 2024

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
💖 💪 🙅 🚩
anuragdhunna
Anurag Dhunna

Posted on June 20, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related