Search packages, repositories and app categories

Package detailsv1.0.0

dataclass

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

30-day downloads
66
Likes
63
Pub points
40

Install package

flutter pub add dataclass

Package Overview

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

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

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

packages/freezed/README.md

Categories

Dependencies

Dependency list 3 items

Source repository

Projects using this package

No data available yet.