list<T, F extends Fw<T>> static method

CachedFu<T, int, List<T>, F> list<T, F extends Fw<T>>({
  1. required Fu<List<T>> fv,
  2. required F wrap(
    1. Fw<T> item
    ),
  3. T? defaultValue,
  4. DspReg? disposers,
})

Implementation

static CachedFu<T, int, List<T>, F> list<T, F extends Fw<T>>({
  required Fu<List<T>> fv,
  required F Function(Fw<T> item) wrap,
  T? defaultValue,
  DspReg? disposers,
}) {
  final cache = Cache<int, F>((index) {
    final item = fv.itemFwHot(
      index,
      defaultValue: defaultValue,
      disposers: disposers,
    );
    return wrap(item);
  });
  return CachedFu(
    fv: fv,
    item: cache.get,
    get: (collection, key) =>
    key < collection.length ? collection[key] : null,
    keys: (collecion) => collecion.mapIndexed((index, element) => index),
    sortedKeys: (collecion) =>
        collecion.mapIndexed((index, element) => index),
    disposers: disposers,
  );
}