FLUTTER ECOSYSTEM

dataclass

Code generation for immutable classes that has a simple syntax/API without compromising on the features.

Latest version
1.0.0
30-day downloads
35
Likes
63
Pub points
40

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Overview

DataClass is a Flutter/Dart package that simplifies the creation of immutable data classes through code generation. It offers a clean, minimal syntax for defining classes with built-in support for equality, hashing, copying, and JSON serialization. Designed with developer experience in mind, it reduces boilerplate without sacrificing functionality. The package integrates seamlessly into Flutter projects and is ideal for managing state and model objects in a type-safe, maintainable way.

Use cases
  • Defining immutable data models
  • Generating JSON serialization
  • Simplifying state management
  • Creating reusable value objects
  • Reducing boilerplate in domain models
Key features
  • Automatic equality and hash code generation
  • CopyWith method generation
  • JSON serialization support
  • Minimal syntax with annotations
  • Code generation via build_runner
Suitable for
  • Flutter developers using Riverpod or similar state management
  • Projects requiring immutable data structures
  • Apps with heavy use of JSON data
  • Teams prioritizing code cleanliness and maintainability
Considerations
  • Requires build_runner for code generation
  • Limited to classes marked with @dataclass annotation
  • May increase build time slightly
  • Not suitable for mutable classes
  • Depends on external package (freezed) for implementation
Supported platformsNot available

Install package

flutter pub add dataclass

Categories

Dependencies

Dependency list 3 items

Source repository

Related projects

No data available yet.