@@ -72,12 +72,12 @@ that can be selected and grouped in various combinations to meet specific cache
7272requirements.
7373
7474[ JsonCache] ( https://pub.dev/documentation/json_cache/latest/json_cache/JsonCache-class.html )
75- is the core interface of this package and represents the concept of cached data.
76- It is defined as:
75+ is the core Dart interface of this package and represents the concept of cached
76+ data. It is defined as:
7777
7878``` dart
7979/// Represents cached data in json format.
80- abstract class JsonCache {
80+ abstract interface class JsonCache {
8181 /// Frees up storage space — deletes all keys and values.
8282 Future<void> clear();
8383
@@ -97,6 +97,11 @@ abstract class JsonCache {
9797 ///
9898 /// Returns `true` if there is cached data at [key]; `false` otherwise.
9999 Future<bool> contains(String key);
100+
101+ /// The cache keys.
102+ ///
103+ /// Returns an **unmodifiable** list of all cache keys without duplicates.
104+ Future<UnmodifiableListView<String>> keys();
100105}
101106```
102107
@@ -281,9 +286,14 @@ is an implementation on top of the
281286[ localstorage] ( https://pub.dev/packages/localstorage ) package.
282287
283288``` dart
289+ import 'package:flutter/material.dart';
290+ import 'package:localstorage/localstorage.dart';
291+
284292 …
285293 final LocalStorage storage = LocalStorage('my_data');
286- final JsonCache jsonCache = JsonCacheMem(JsonCacheLocalStorage(storage));
294+ WidgetsFlutterBinding.ensureInitialized();
295+ await initLocalStorage();
296+ final JsonCache jsonCache = JsonCacheMem(JsonCacheLocalStorage(localStorage));
287297 …
288298```
289299
0 commit comments