operator == method

  1. @override
bool operator ==(
  1. Object other
)
inherited

Provides structural equality for tissues.

Equality is determined by:

  1. Identity: If both references point to the same object.
  2. Unmodifiable Linkage: If other is an Unmodifiable view pointing back to this.
  3. Content Equality: If other is a standard Iterable, equality is delegated to the underlying _nucleus.container.

When to use

This operator is called automatically when comparing tissues for equality. You rarely need to invoke it directly.

How it works

  • First checks if the objects are identical (same instance).
  • If other is an Unmodifiable view of this, returns true.
  • If other is an Iterable, delegates to the underlying container's equality logic.
  • Otherwise, returns false.

Parameters:

  • other: The object to compare with this tissue.

Returns:

true if the tissues are equal; false otherwise.

Implementation

@override
bool operator ==(Object other) {
  if (identical(this, other)) {
    return true;
  }
  if (other is Tissue<E>) {
    if (other is Unmodifiable) {
      if (other._nucleus.bind != null &&
          identical(this, other._nucleus.bind)) {
        return identical(other, unmodifiable);
      }
    }
  }
  if (other is Iterable<E>) {
    return _nucleus.container == other;
  }
  return false;
}