compareList static method

bool compareList(
  1. List arr1,
  2. List arr2
)

Implementation

static bool compareList(List arr1, List arr2) {
  if (arr1.length != arr2.length) {
    return false;
  }
  var isSameValue = true;
  for (var i = 0; i < arr1.length; i++) {
    var ele = arr1[i];
    var otherEle = arr2[i];
    if (ele.runtimeType == otherEle.runtimeType) {
      if (ele is List) {
        isSameValue = compareList(ele, otherEle);
        if (!isSameValue) {
          break;
        }
      } else if (ele is Map) {
        isSameValue = mapContainEqual(ele, otherEle);
        if (!isSameValue) {
          break;
        }
      } else if (ele != otherEle) {
        isSameValue = false;
        break;
      }
    } else {
      isSameValue = false;
      break;
    }
  }
  return isSameValue;
}