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)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up