copy_with_extension
18.0.1, released 5 days ago by alexander-kirsch.com
Annotation for generating copyWith extensions code using copy_with_extension_gen.
What it does
Defines annotations that work with copy_with_extension_gen to automatically generate copyWith extension methods for Dart classes and record typedefs, helping to maintain immutability.
AI-written summary of version 18.0.0, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want to generate copyWith methods for immutable classes without writing them manually
- You need shallow copyWith support for annotated record typedefs
Skip it when
- You prefer manual implementation of copyWith methods
- You are already using a comprehensive code generation solution like freezed that includes copyWith out of the box
Strengths
- Automates boilerplate generation for immutable models
- Supports Dart primary constructors and shallow copying for record typedefs
Weaknesses
- Requires build_runner and a separate generator package to produce code
- Breaking changes in generator rules can require updating generated files and class configurations
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Requires adding the package and its generator counterpart, then running build_runner.
not documentedAlternatives
Packages that do the same job and could replace copy_with_extension.
- freezed
Provides a comprehensive solution for union types, pattern matching, and built-in copyWith generation without needing separate manual models.
96Compare - built_value
Offers immutable value types with custom serialization and builders as an alternative to standard data classes.
88Compare
Works with
Packages commonly used together with copy_with_extension: ones it builds on, ones built on it, and its own family.
- copy_with_extension_genBuilt on copy_with_extensionGenerate type‑safe copyWith extensions for annotated classes and record typedefs.
- text_sightBuilt on copy_with_extensionLive, on-device text recognition for Flutter using Apple Vision on iOS and ML Kit on Android.
- mastodonBuilt on copy_with_extensionUnofficial Mastodon API client generated from OpenAPI spec
- figmaBuilt on copy_with_extensionA pure Dart wrapper library for interacting with the Figma API with typed responses.
- flexi_klineBuilt on copy_with_extensionA flexible Flutter candlestick chart framework for stock and crypto markets.
- flutter_zktecoBuilt on copy_with_extensionFlutter plugin to connect to ZKTeco fingerprint machines over TCP/IP
- widget_toolkitBuilt on copy_with_extensionThe Widget Toolkit package consists of several lightweight and customisable UI components that boost productivity and reduce the development time.