dart equality
A high-performance object equality and deep collection comparison engine for Dart and Flutter.
Installation
dependencies:
dart_equality: ^latest_version
Usage
Extend or mixin DartEquality and implement props to automatically override == and hashCode.
import 'package:dart_equality/dart_equality.dart';
class Credentials with DartEquality {
const Credentials({required this.username, required this.password});
final String username;
final String password;
@override
List<Object> get props => [username, password];
}
void main() {
const credentialsA = Credentials(username: 'username', password: 'password');
const credentialsB = Credentials(username: 'username', password: 'password');
print(credentialsA == credentialsB); // true
}