swapped method

Bloom<List<E>> swapped(
  1. int index1,
  2. int index2
)

Returns a new unmodifiable list with two elements swapped reactively.

  • index1: Index of the first element to swap.
  • index2: Index of the second element to swap.

Implementation

Bloom<List<E>> swapped(int index1, int index2) => computed((via) {
      final copy = via(_listBloom).toList();
      col.ListExtensions(copy).swap(index1, index2);
      return List<E>.unmodifiable(copy);
    });