getKeys method
Returns a list of all keys in the cache.
Throws a CacheException if there is an error retrieving the keys.
The limit
and offset
parameters can be used to paginate the results.
Implementation
@override
Future<List<String>> getKeys({int? limit, int? offset}) async {
if (!_isInitialized) await init();
final keys = _box.keys.toList().cast<String>();
if (limit == null && offset == null) {
return keys;
}
final startIndex = offset ?? 0;
final endIndex = limit == null ? keys.length : startIndex + limit;
return keys.skip(startIndex).take(endIndex - startIndex).toList();
}