@@ -16,12 +16,12 @@ typedef OnInitError = FutureOr<Null> Function(Object, StackTrace);
1616class JsonCacheMem implements JsonCache {
1717 /// In-memory level1 cache with an optional level2 instance.
1818 ///
19- /// ATTENTION : if you do not pass an object to the parameter [level2] , the
20- /// data will remain cached in-memory only; that is, no data will be persited
21- /// to the user's device's local storage area. Indeed, not persisting data on
22- /// the user's device might be the desired behavior if you are at the
23- /// prototyping or mocking phase. However, its unlikely to be the right
24- /// behavior in production code.
19+ /// **Note** : if you do not pass an object to the parameter [level2] , the data
20+ /// will remain cached in-memory only; that is, no data will be persited to
21+ /// the user's device's local storage area. Indeed, not persisting data on the
22+ /// user's device might be the desired behavior if you are at the prototyping
23+ /// or mocking phase. However, its unlikely to be the right behavior in
24+ /// production code.
2525 JsonCacheMem ([JsonCache ? level2])
2626 : this .mem (_shrMem, level2: level2, mutex: _shrMutex);
2727
@@ -73,14 +73,14 @@ class JsonCacheMem implements JsonCache {
7373 Map <String , Map <String , dynamic >?> mem, {
7474 JsonCache ? level2,
7575 ReadWriteMutex ? mutex,
76- }) : _level2 = level2 ?? const JsonCacheHollow () ,
77- _memory = mem ,
76+ }) : _memory = mem ,
77+ _level2 = level2 ?? const JsonCacheHollow () ,
7878 _mutex = mutex ?? ReadWriteMutex ();
7979
8080 /// Slower cache level.
8181 final JsonCache _level2;
8282
83- /// in -memory storage.
83+ /// In -memory storage.
8484 final Map <String , Map <String , dynamic >?> _memory;
8585
8686 /// Mutex lock-guard.
@@ -135,8 +135,9 @@ class JsonCacheMem implements JsonCache {
135135 Future <Map <String , dynamic >?> value (String key) {
136136 return _mutex.protectRead (() async {
137137 final cachedL1 = _memory[key];
138- if (cachedL1 != null ) return Map <String , dynamic >.of (cachedL1);
139-
138+ if (cachedL1 != null ) {
139+ return Map <String , dynamic >.of (cachedL1);
140+ }
140141 final cachedL2 = await _level2.value (key);
141142 if (cachedL2 != null ) {
142143 _memory[key] = cachedL2;
0 commit comments