listKeys method

  1. @override
Future<List<String>> listKeys()
override

Lists all available snapshot keys.

Returns: A Future that completes with a list of available snapshot keys.

Implementation

@override
Future<List<String>> listKeys() async {
  try {
    final prefs = await _prefs;
    final allKeys = prefs.getKeys();
    final snapshotKeys = allKeys
        .where((key) => key.startsWith(keyPrefix))
        .map((key) => key.substring(keyPrefix.length))
        .toList()
      ..sort();
    return snapshotKeys;
  } catch (e) {
    debugPrint('[Checkpoint] Error listing snapshot keys: $e');
    return [];
  }
}