dart_equality 1.0.0 copy "dart_equality: ^1.0.0" to clipboard
dart_equality: ^1.0.0 copied to clipboard

A Dart package that allows values to be compared equality without having to implement the == and hashCode methods.

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
}

Maintainers #

1
likes
160
points
36
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A Dart package that allows values to be compared equality without having to implement the == and hashCode methods.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

flutter, meta

More

Packages that depend on dart_equality