deepEquals method

bool deepEquals(
  1. Iterable? other, {
  2. bool ignoreOrder = false,
})

Compare all items, in order or not, according to ignoreOrder, using operator ==. Return true if they are all the same, in the same order.

Implementation

bool deepEquals(Iterable? other, {bool ignoreOrder = false}) {
  if (identical(this, other)) return true;
  if (other == null) return false;

  // Assumes `EfficientLengthIterable` for these:
  if ((this is List) ||
      (this is Set) ||
      (this is Queue) ||
      (this is ImmutableCollection)) if (length != other.length) return false;

  return ignoreOrder
      ? const UnorderedIterableEquality<dynamic>(IdentityEquality<dynamic>()).equals(this, other)
      : const IterableEquality<dynamic>(IdentityEquality<dynamic>()).equals(this, other);
}