getCachedEntries method
FutureOr<Map<String, String> ?>
getCachedEntries(
- Map<
String, String> entries, - IntlLocale fromLocale,
- IntlLocale toLocale
Returns the cached translations for entries
(if cache is provided).
Implementation
FutureOr<Map<String, String>?> getCachedEntries(
Map<String, String> entries,
IntlLocale fromLocale,
IntlLocale toLocale,
) {
var cache = this.cache;
if (cache == null) return null;
var results = Map.fromEntries(entries.entries.map((e) {
var k = e.key;
var t = cache.get(k, e.value, fromLocale, toLocale);
return t != null ? MapEntry(k, t) : null;
}).whereNotNull())
.resolveAllValues();
return results.resolveMapped((map) {
var mapCached = Map<String, String>.fromEntries(map.entries.where((e) {
var m = e.value;
return m != null && m.trim().isNotEmpty;
}).map((e) => MapEntry(e.key, e.value!)));
return mapCached;
});
}