equatable 0.1.5 icon indicating copy to clipboard operation
equatable: ^0.1.5 copied to clipboard

outdated

An abstract class that helps to implement equality without needing to explicitly override == and hashCode.

example/main.dart

import 'package:equatable/equatable.dart';

class Credentials extends Equatable {
  final String username;
  final String password;

  Credentials({this.username, this.password}) : super([username, password]);
}

void main() {
  final credentialsA = Credentials(username: 'Joe', password: 'password123');
  final credentialsB = Credentials(username: 'Bob', password: 'password!');
  final credentialsC = Credentials(username: 'Bob', password: 'password!');

  print(credentialsA == credentialsA); // true
  print(credentialsB == credentialsB); // true
  print(credentialsA == credentialsB); // false
  print(credentialsB == credentialsC); // true
}
2143
likes
0
pub points
100%
popularity

Publisher

verified publisher iconfluttercommunity.dev

An abstract class that helps to implement equality without needing to explicitly override == and hashCode.

Repository (GitHub)
View/report issues

License

Icon for licenses.unknown (LICENSE)

Dependencies

collection

More

Packages that depend on equatable