Skip to content
pubscout

equatable

3.0.0, released 2 months ago by fluttercommunity.dev

Provides value‑based equality for Dart objects without manual == and hashCode.

WASM-readyRock solid
$ flutter pub add equatable
Source repository

What it does

Equatable overrides == and hashCode based on a list of props, simplifying equality checks. It also offers optional toString support and works with immutable classes.

AI-written summary of version 3.0.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need concise, reliable equality for data classes
  • You want to avoid boilerplate in models and tests

Skip it when

  • You require code generation for other purposes
  • You need mutable objects with custom equality

Strengths

  • Eliminates boilerplate equality code
  • Works with const constructors and nullable props
  • No build_runner or codegen required

Weaknesses

  • Only supports immutable objects
  • Limited to equality; not a full data‑class solution

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
import 'package:equatable/equatable.dart';

class Person extends Equatable {
  const Person(this.name);
  final String name;
  @override
  List<Object> get props => [name];
}

Alternatives

Packages that do the same job and could replace equatable.

  • stack_trace

    Provides detailed stack trace utilities, not equality-focused

  • uuid

    Generates unique identifiers, unrelated to equality

Works with

Packages commonly used together with equatable: ones it builds on, ones built on it, and its own family.