felangel/equatable

Support for mutable class objects

busslina opened this issue · 3 comments

In documentation it is said:

We can now compare instances of Person just like before without the pain of having to write all of that boilerplate. Note: Equatable is designed to only work with immutable objects so all member variables must be final (This is not just a feature of Equatable - overriding a hashCode with a mutable value can break hash-based collections).

Then I get this warning in my class that extends Equatable:
imagen

Well I think, classes should be allowed to have non final fields if these fields are not used in hash or equalty.

What do you think about this?

Thank you

@busslina Why don't you just use EquatableMixin if you want to avoid this warning? In general it makes sense that Equatable has a const constructor.

@busslina Why don't you just use EquatableMixin if you want to avoid this warning? In general it makes sense that Equatable has a const constructor.

I didn't knew that it exists. I created my custom Equatable.

I will take a look at EquatableMixin.

Thank you

Migrated to EquatableMixin haha