stop method

Future<void> stop()

Stop location tracking

Stops the background location service and cleans up resources.

Implementation

Future<void> stop() async {
  if (!_isTracking) return;

  try {
    await BackgroundLocator.unRegisterLocationUpdate();
    _isTracking = false;
    _currentConfig = null;
    _onLocation = null;
    _onError = null;
    debugPrint('Live location tracking stopped');
  } catch (e) {
    debugPrint('Failed to stop location tracking: $e');
    rethrow;
  }
}