equatable 0.1.2 copy "equatable: ^0.1.2" to clipboard
equatable: ^0.1.2 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
}
3207
likes
0
pub points
100%
popularity

Publisher

verified publisherfluttercommunity.dev

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

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on equatable