felangel / equatable

A Dart package that helps to implement value based equality without needing to explicitly override == and hashCode.
https://pub.dev/packages/equatable
MIT License
901 stars 100 forks source link

feat: make Equatable `abstract mixin class` #161

Closed utamori closed 1 month ago

utamori commented 1 year ago

Status

READY

Breaking Changes

NO

Description

Make Equatable class an abstract mixin class so that it can be used as a mixin

Related PRs

no

Todos

Steps to Test or Reproduce

Outline the steps to test or reproduce the PR here.

dart test

Impact to Remaining Code Base

This PR will affect:

felangel commented 1 month ago

This change is still a breaking change and I don't think it's worth it especially considering I'm planning to make the next major version of equatable use macros instead so you'd always just annotate your class with @Equatable and that's it (no more props 🎉)

@Equatable()
class Person {
  const Person({required this.name});
  final String name;
}

See also https://github.com/felangel/data_class which will be built on top of the equatable macro so you could go a few steps further:

@Data()
class Person {
  final String name;
}
felangel commented 1 month ago

Closing for now based on my above comment, thanks so much for the contribution though -- I really appreciate it!