Search packages, repositories and app categories

Package detailsv18.0.0

copy_with_extension

Annotation for generating `copyWith` extensions code using `copy_with_extension_gen`.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
235K
Likes
111
Pub points
160

Install package

flutter pub add copy_with_extension

Package Overview

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

A Dart package that provides an annotation to automatically generate `copyWith` extension methods for classes using the `copy_with_extension_gen` code generator. This simplifies immutable object updates by allowing developers to create new instances with modified fields without manually writing boilerplate code. The generated extensions are type-safe and integrate seamlessly into Flutter and Dart projects across multiple platforms. It enhances code maintainability and reduces errors in state management and model classes.

Use cases

  • Simplifying immutable data class updates
  • Reducing boilerplate in state management
  • Generating type-safe copy operations
  • Enhancing model class usability
  • Streamlining Flutter app development
  • Supporting reactive programming patterns

Key features

  • Annotation-based code generation
  • Type-safe `copyWith` extensions
  • Cross-platform support
  • Minimal boilerplate
  • Integration with `copy_with_extension_gen`
  • Automatic field-by-field updates

Suitable for

  • Flutter developers using immutable models
  • State management with immutable data
  • Teams prioritizing code cleanliness
  • Projects using code generation
  • Developers working with complex data structures
  • Apps requiring frequent data mutations

Considerations

  • Requires code generation setup
  • Depends on `copy_with_extension_gen`
  • Needs build_runner for generation
  • May increase build time
  • Not suitable for runtime-only scenarios
  • Limited to annotated classes

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 1 items

Source repository

Projects using this package