equals method

  1. @Possible({StackOverflowError})
  2. @useResult
bool equals(
  1. Object? other
)

Determines if this and other are deeply equal.

A list is only equal to another list if they contain the same elements in the same order. All other iterables only need to contain the same elements to be equal.

This function is unlike Iterable.== which is identity-based.

Contract

A StackOverflowError is thrown if this or other contain themselves.

final a = [];
a.add(a);

a.equals([]); // Throws StackOverflowError

Implementation

@Possible({StackOverflowError})
@useResult bool equals(Object? other) => Equality.deep(this, other);