removeAllSavedVehicles method

void removeAllSavedVehicles()

Deletes all saved vehicle associations from the device.

Removes all previously saved vehicle Bluetooth devices from the user's saved vehicle list. This effectively resets the vehicle configuration and will disable automatic trip detection until new vehicles are saved.

Usage:

try {
  // Confirm with user before deleting
  final confirmed = await showConfirmationDialog('Delete all vehicles?');
  if (confirmed) {
    communicator.removeAllSavedVehicles();
    print('All saved vehicles deleted');

    // Update UI to reflect no saved vehicles
    // Prompt user to scan and save vehicles again
  }
} catch (e) {
  print('Failed to delete vehicles: $e');
}

Important Notes:

  • This action cannot be undone
  • Removes ALL saved vehicles, not just one
  • Automatic trip detection will be disabled until vehicles are re-added
  • User will need to re-scan and save their vehicles

Use Cases:

  • Resetting vehicle configuration
  • Troubleshooting trip detection issues
  • User switching to different vehicles permanently
  • Clean slate setup for new users
  • Factory reset scenarios

Side Effects:

  • Disables automatic trip start/end detection
  • May affect trip recording accuracy
  • User will need to manually start/stop trips until vehicles are re-configured

Implementation

void removeAllSavedVehicles() {
  try {
    kruzr_comm.removeAllSavedVehicles();
  } on Exception catch (e, stackTrace) {
    if (kDebugMode) {
      print("Error in removeAllSavedVehicles");
      print(stackTrace);
      print(e);
    }
  }
}