easy_copy_with_annotation 1.0.0 copy "easy_copy_with_annotation: ^1.0.0" to clipboard
easy_copy_with_annotation: ^1.0.0 copied to clipboard

Annotations for the easy_copy_with code generator. Add @CopyWith() to your Dart classes.

example/example.dart

import 'package:easy_copy_with_annotation/easy_copy_with_annotation.dart';

/// Annotate your class with `@CopyWith()` and run `build_runner`
/// to generate a type-safe `copyWith` method.
///
/// Generated part file omitted — see the `easy_copy_with` package
/// for a full working example with `build_runner`.
///
/// ```bash
/// dart run build_runner build
/// ```
///
/// After code generation:
/// ```dart
/// final user = User(name: 'Alice', age: 25);
/// final updated = user.copyWith(age: 26);
/// final cleared = user.copyWith(email: null);
/// ```
@CopyWith()
class User {
  final String name;
  final int age;
  final String? email;

  const User({required this.name, required this.age, this.email});
}
0
likes
160
points
371
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Annotations for the easy_copy_with code generator. Add @CopyWith() to your Dart classes.

Repository (GitHub)
View/report issues

Topics

#codegen #copy-with #code-generation #annotation

License

MIT (license)

More

Packages that depend on easy_copy_with_annotation