itemFwHot method

Fw<V> itemFwHot(
  1. int index, {
  2. V? defaultValue,
  3. DspReg? disposers,
})

Implementation

Fw<V> itemFwHot(
  int index, {
  V? defaultValue,
  DspReg? disposers,
}) {
  return frw(
    fr(
      () {
        final list = watch();
        if (index >= list.length) {
          return defaultValue ?? (throw 'itemFwHot defaultValue is null');
        }
        return list[index];
      },
      disposers: disposers,
    ),
    (value) {
      update((list) {
        if (index >= list.length) return;
        list[index] = value;
      });
    },
  );
}