Equatable class

A base class to facilitate operator== and hashCode overrides.

class ConstTest extends Equatable {
  const ConstTest(this.a);

  final int a;

  @override
  List<Object> get props => [a];
}
Annotations
  • @immutable

Constructors

Equatable()
A class that helps implement equality without needing to explicitly override == and hashCode. Equatables override their own == operator and hashCode based on their props.
const

Properties

hashCode int
The hash code for this object. [...]
read-only, override
props List<Object>
The List of props (properties) which will be used to determine whether two Equatables are equal.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
stringify bool
If the value is true, the toString method will be overrided to print the equatable props.
read-only

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toString() String
Returns a string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator. [...]
override