operator == method

bool operator ==(
  1. Object other
)
override

The equality operator.

It's checking if the other object is of the same type as the Obj, if it is, it compares the value, else it compares like Object using hashCode.

Examples:

final obj = Obj(0);
final obj2 = Obj(0);
final obj3 = obj;

print(obj == 0); // true
print(obj == 1); // false
print(obj == obj); // true
print(obj == obj2); // false
print(obj == obj3); // true

Implementation

bool operator ==(Object other) =>
    other is Obj<T> ? value == other.value : value == other;