listEquals<E> function

bool listEquals<E>(
  1. List<E> list1,
  2. List<E> list2
)

Naive List equality implementation.

Implementation

bool listEquals<E>(List<E> list1, List<E> list2) {
  if (identical(list1, list2)) {
    return true;
  }

  if (list1.length != list2.length) {
    return false;
  }

  for (var i = 0; i < list1.length; i += 1) {
    if (list1[i] != list2[i]) {
      return false;
    }
  }

  return true;
}