enableFollowModeWithCompass method

Future<void> enableFollowModeWithCompass()

Locks camera and rotates map to match device heading (compass).

Ideal for navigation mode where map rotates with user direction.

Implementation

Future<void> enableFollowModeWithCompass() async {
  final hasPermission = await requestPermission();
  if (!hasPermission) return;

  _mode = TrackingMode.followWithCompass;
  modeNotifier.value = _mode;

  // Enable native MapLibre compass tracking
  await mapController.updateMyLocationTrackingMode(
    MyLocationTrackingMode.trackingCompass,
  );

  // Start Geolocator stream for smooth camera follow with heading
  await _startPositionStream();

  // Jump to current location immediately
  await _jumpToCurrentLocation();
}