swapItemInLists<T> function

void swapItemInLists<T>(
  1. List<List<T>> lists,
  2. T element,
  3. List<T> targetList,
  4. int targetIndex,
)

Implementation

void swapItemInLists<T>(
    List<List<T>> lists, T element, List<T> targetList, int targetIndex) {
  for (var list in lists) {
    if (list != targetList) {
      list.remove(element);
    }
  }
  targetList.swapItem(element, targetIndex);
}