Skip to content
pubscout

equatable_gen

1.3.2, released 8 months ago by mrgnhnt.com

Generates Equatable props getters via build_runner

$ flutter pub add equatable_gen
Source repository

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.

  • tonik

    Pure Dart OpenAPI 3.0/3.1 code generator for type-safe API client packages.

Works with

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