dispose method

Future<void> dispose()

Disposes of all location service resources

Implementation

Future<void> dispose() async {
  debugPrint('[LOCATION] Disposing location service at ${DateTime.now()}');
  await stopLocationUpdates();

  // Also stop the foreground service if it's still running
  if (_isNavigationActive) {
    bool stopped = await _foregroundService.stopForegroundTask();
    debugPrint('[LOCATION] Foreground service stopped during dispose: $stopped');
  }

  _foregroundService.dispose();
  _showErrorCallback = null;
}