FLUTTER ECOSYSTEM

copy_with_extension

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

Latest version
15.0.1
30-day downloads
162.8K
Likes
111
Pub points
160

Package Overview

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

Overview

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
Supported platformsAndroidiOSWebmacOSWindowsLinux

Install package

flutter pub add copy_with_extension

Categories

Source repository

Related projects