getLocationStream method

Stream<Position> getLocationStream()

Provides a stream of location updates using foreground service when navigation is active

Implementation

Stream<geo.Position> getLocationStream() {
  // Initialize stream if not already created
  _locationStreamController ??= StreamController<geo.Position>.broadcast();

  // Start location updates if not already started
  if (_positionSubscription == null && _foregroundLocationSubscription == null) {
    debugPrint('[LOCATION] Starting position subscription...');
    _startLocationUpdates();
  }

  return _locationStreamController!.stream;
}