compareWith method
Compares this object with another for equality.
This is the implementation behind the == operator. It checks:
- Identity (same reference)
- Type equality
propsequality (deep comparison)
When to use directly:
Call this from a custom == override if you need pre/post processing:
@override
operator ==(Object other) {
if (other is! MyRoute) return false;
// Custom pre-check
return compareWith(other);
}
Implementation
@pragma('vm:prefer-inline')
bool compareWith(Object other) {
if (identical(this, other)) return true;
return other is Equatable &&
other.runtimeType == runtimeType &&
iterableEquals(props, other.props);
}