deepEqualsByIdentity method

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

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

Implementation

bool deepEqualsByIdentity(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);
}