map<T, K, F extends Fw<T>> static method
CachedFu<T, K, Map<K, T>, F>
map<
T, K, F extends Fw<T>>({ - required Fu<Map<K, T>> fv,
- required F wrap(
- Fw<T> item
),
- T? defaultValue,
- DspReg? disposers,
})
Implementation
static CachedFu<T, K, Map<K, T>, F> map<T, K, F extends Fw<T>>({
required Fu<Map<K, T>> fv,
required F Function(Fw<T> item) wrap,
T? defaultValue,
DspReg? disposers,
}) {
final cache = Cache<K, F>((index) {
final item = fv.itemFwHot(
index,
defaultValue: defaultValue,
disposers: disposers,
);
return wrap(item);
});
return CachedFu(
fv: fv,
item: cache.get,
get: (collection, key) => collection[key],
keys: (collecion) => collecion.keys,
sortedKeys: (collecion) => collecion.keys.sorted(compareNaturalOrder),
disposers: disposers,
);
}