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(1);
final obj3 = obj(0);
final objCopy = obj;

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

Implementation

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