what is different between Equatable and Freezed in flutter?

Viewed 3118

Hi I'm new to flutter and I was following some youtube tutorials and I got wonder what is different between Equatable and Freezed in flutter? I mean purpose of using it is same but I just want to know in which case we better use Equatable or Freezed.

1 Answers

I mean purpose of using it is same

Not at all. Equatable is "An abstract class that helps to implement equality without needing to explicitly override == and hashCode.". Freezed is "Code generation for immutable classes that has a simple syntax/API without compromising on the features."

Sure, they both override == and hashCode, but after that, they are very different. Equatable is a mixin to give a consistent, easy == and hashCode (although not necessarily the most efficient). Freezed is a build system that can use annotations to make immutable classes. Definitely different.

Related