listKeys method
Lists all available snapshot keys.
Returns: A Future that completes with a list of available snapshot keys.
Implementation
@override
Future<List<String>> listKeys() async {
await _ensureDirectory();
if (!await directory.exists()) {
return [];
}
try {
final files =
directory
.listSync()
.whereType<File>()
.where((file) => file.path.endsWith('.json'))
.map((file) {
final fileName = file.path.split('/').last;
return fileName.replaceAll('.json', '');
})
.toList()
..sort();
return files;
} catch (e) {
debugPrint('[Checkpoint] Error listing snapshot keys: $e');
return [];
}
}