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
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
92Compare - uuid
Generates unique identifiers, unrelated to equality
88Compare
Works with
Packages commonly used together with equatable: ones it builds on, ones built on it, and its own family.
- fl_chartBuilt on equatableA highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart.
- flutter_timezoneBuilt on equatableA flutter plugin for getting the local timezone of the device.
- cli_completionBuilt on equatableCompletion functionality for Dart Command-Line Interfaces built using CommandRunner.
- patrol_logBuilt on equatableLog package for Patrol, a Flutter-native UI testing framework
- patrolBuilt on equatableMultiplatform E2E UI testing framework for Flutter
- purchases_flutterBuilt on equatableFlutter plugin for RevenueCat in‑app purchases and subscriptions across iOS, Android, web and macOS.
- excelBuilt on equatableRead, create, edit and write XLSX Excel files in Dart/Flutter.
- alchemistBuilt on equatableStreamlined golden testing tool for Flutter with local and CI-safe output support