isEqualsIterableDeep function

bool isEqualsIterableDeep(
  1. Iterable? it1,
  2. Iterable? it2, {
  3. ValueEquality? valueEquality,
})

Same as isEqualsListDeep but for Iterable.

Implementation

bool isEqualsIterableDeep(Iterable? it1, Iterable? it2,
    {ValueEquality? valueEquality}) {
  if (identical(it1, it2)) return true;

  if (it1 == null || it2 == null) return false;

  var length = it1.length;
  if (length != it2.length) return false;

  for (var i = 0; i < length; i++) {
    var v1 = it1.elementAt(i);
    var v2 = it2.elementAt(i);

    if (!isEqualsDeep(v1, v2, valueEquality: valueEquality)) return false;
  }

  return true;
}