refresh method

  1. @override
Future<void> refresh(
  1. String key,
  2. Map<String, dynamic> value
)
override

It either updates the data found at key with value or, if there is no previous data at key, creates a new cache line at key with value.

Note: value must be json encodable.

Implementation

@override
Future<void> refresh(String key, Map<String, dynamic> value) async {
  final dataCopied = Map<dynamic, dynamic>.of(await _cachedData);
  dataCopied[key] = value;
  await _localStorage.write(dataCopied);
}