Search packages, repositories and app categories

Package detailsv18.0.0

copy_with_extension_gen

Automatically generating `copyWith` extensions code for classes with `@CopyWith()` annotation.

AndroidiOSmacOSWindowsLinux
30-day downloads
136K
Likes
220
Pub points
160

Install package

flutter pub add copy_with_extension_gen

Package Overview

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

A code generation package that automatically creates `copyWith` extension methods for Dart classes annotated with `@CopyWith()`. It simplifies immutable object updates by generating boilerplate-free, type-safe copy operations. Ideal for state management and data modeling in Flutter apps, reducing manual coding and potential errors. The generated extensions support nested objects and preserve null safety. Works seamlessly across all major platforms.

Use cases

  • State management in Flutter apps
  • Immutable data class updates
  • Reducing boilerplate in model classes
  • Streamlined JSON serialization workflows
  • Refactoring large data models

Key features

  • Auto-generates `copyWith` extensions
  • Supports nested and complex types
  • Null safety compliant
  • Minimal setup with annotations
  • Cross-platform compatibility

Suitable for

  • Developers using immutable data classes
  • Teams prioritizing code maintainability
  • Projects with heavy use of value objects
  • Flutter apps with complex state logic
  • Code generation enthusiasts

Considerations

  • Requires build_runner for code generation
  • Needs proper annotation on target classes
  • May increase build time slightly
  • Not suitable for runtime-only scenarios
  • Limited to classes with `@CopyWith()` annotation

Original README

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

Pub Package - copy_with_extension Pub Package - copy_with_extension_gen CI

Provides Dart Build System builder for generating copyWith extensions for classes annotated with copy_with_extension.

For usage details, see copy_with_extension_gen.

For insight into how this package works, see my blog post.

copy_with_extension

copy_with_extension_gen

Categories

Dependencies

Dependency list 5 items

Source repository

Projects using this package

Rankings