mek_data_class
2.2.0, released 11 months ago by an unverified publisher
Low-code generation for hashCode, ==, toString, copyWith, change, and Builder methods.
What it does
Generates boilerplate methods like hashCode, ==, toString, copyWith, merge, and Builder classes for Dart classes using a build_runner setup. It uses mixins to remain minimally intrusive on the class interface and supports inheritance, generics, and null values.
AI-written summary of version 2.2.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to generate boilerplate methods for data classes with low code overhead.
- You need support for copyWith, builders, and change classes via mixins.
Skip it when
- You do not want to use code generation or build_runner in your project.
Strengths
- Minimally intrusive on the class interface through generated mixins.
- Supports inheritance and generic classes.
- Provides helper classes like *Changes and *Builder for data manipulation.
Weaknesses
- Requires a build_runner code-generation setup.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- Yes (build_runner)
- Direct dependencies
- 3
Requires adding mek_data_class and build_runner with mek_data_class_generator to pubspec.yaml, and running build_runner.
@DataClass()
class Product with _$Product {
final String title;
final double price;
const Product({
required this.title,
required this.price,
});
}Alternatives
Packages that do the same job and could replace mek_data_class.
- freezed
More feature-rich union types and immutable state modeling using code generation.
96Compare - built_value
Strict immutability and deep builder patterns for complex data structures.
88Compare