map<T, K, F extends Fw<T>> static method

CachedFu<T, K, Map<K, T>, F> map<T, K, F extends Fw<T>>({
  1. required Fu<Map<K, T>> fv,
  2. required F wrap(
    1. Fw<T> item
    ),
  3. T? defaultValue,
  4. 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,
  );
}