clear method
Clears all snapshots from storage.
Returns: A Future that completes when all snapshots are cleared.
Implementation
@override
Future<void> clear() async {
await _ensureDirectory();
if (!await directory.exists()) {
return;
}
try {
final files = directory.listSync().whereType<File>().where(
(file) => file.path.endsWith('.json'),
);
for (final file in files) {
await file.delete();
}
debugPrint('[Checkpoint] Cleared all snapshots from ${directory.path}');
} catch (e) {
debugPrint('[Checkpoint] Error clearing snapshots: $e');
}
}