delete method

  1. @override
Future<bool> delete(
  1. String key
)
override

Deletes a snapshot from storage.

Parameters:

  • key: The key/identifier of the snapshot to delete

Returns: A Future that completes with true if the snapshot was deleted, false if it didn't exist.

Implementation

@override
Future<bool> delete(String key) async {
  final prefKey = _getStorageKey(key);

  try {
    final prefs = await _prefs;
    final removed = await prefs.remove(prefKey);
    if (removed) {
      debugPrint('[Checkpoint] Deleted snapshot from SharedPreferences: $key');
    }
    return removed;
  } catch (e) {
    debugPrint('[Checkpoint] Error deleting snapshot $key: $e');
    return false;
  }
}