equatable_gen
1.3.2, released 8 months ago by mrgnhnt.com
Generates Equatable props getters via build_runner
What it does
It creates a private extension that supplies the List<Object?> props getter for classes that extend Equatable or use EquatableMixin. The generator can automatically include fields, getters, and respect @ignore/@include annotations.
AI-written summary of version 1.3.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need boilerplate-free equality for Equatable classes
- You want zero-annotation support and inheritance handling
- You are already using build_runner for code generation
Skip it when
- You prefer manual control over props without codegen
- You are not using Equatable or EquatableMixin
Strengths
- Zero-annotation mode with auto_include
- Supports inheritance and getter inclusion
- Easy integration with build_runner
Weaknesses
- Requires build_runner and part files
- Only works with Equatable/EquatableMixin
- No runtime configuration beyond build.yaml
Setup
- Kind
- Pure Dart
- Effort
- Medium
- Code generation
- Yes (build_runner)
- Direct dependencies
- 13
Add equatable_annotations, equatable_gen, build_runner to pubspec; create build.yaml with builder options; add part 'file.g.dart'; run flutter pub run build_runner build
```dart
class MyClass extends Equatable {
const MyClass({required this.id, required this.name});
final String id;
final String name;
@override
List<Object?> get props => _$props;
}
```Alternatives
Packages that do the same job and could replace equatable_gen.
Works with
Packages commonly used together with equatable_gen: ones it builds on, ones built on it, and its own family.
- analyzerequatable_gen depends on itPerforms static analysis of Dart code for tool integration and embedding.
- yamlequatable_gen depends on itA Dart library for parsing YAML documents into Dart data structures.
- dart_styleequatable_gen depends on itProvides an API and CLI to format Dart source code automatically.
- source_spanequatable_gen depends on itStandard representation for source code locations, spans, and human-friendly error messages.
- json_annotationequatable_gen depends on itProvides annotations for json_serializable to generate JSON (de)serialization code.
- code_builderequatable_gen depends on itA fluent, builder-based library for generating valid Dart code programmatically.
- buildequatable_gen depends on itPackage for authoring build_runner compatible code generators.
- equatableequatable_gen depends on itProvides value‑based equality for Dart objects without manual == and hashCode.