compareLists<T> function

bool compareLists<T>(
  1. List<T>? list1,
  2. List<T>? list2
)

Implementation

bool compareLists<T>(List<T>? list1, List<T>? list2) {
  if (list1 == null && list2 == null) return true;
  if (list1 == null || list2 == null) return false;
  if (list1.length != list2.length) return false;

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