copy_annotation 1.0.1 copy "copy_annotation: ^1.0.1" to clipboard
copy_annotation: ^1.0.1 copied to clipboard

Provides an annotation for generating copy methods for Dart classes

Pub Package

"copy_annotation" is a annotation based code generation package for Flutter that generates a copyWith method with extension functions for immutable classes. Work together with copy_annotation_gen to generate code.

Usage #

dependencies:
  copy_annotation: ^latest_version

Then, you need to add the following dependencies for code generation:

dev_dependencies:
  build_runner: ^latest_version
  copy_annotation_gen: ^latest_version

Example #


@copy
class Employee {
    final int id;
    final String name;

    Employee({required this.id,required this.name})

}


final emp1 = Employee(id:1,name:"John");
final emp2 = emp1.copy(id:2,name:"Mina");
1
likes
150
pub points
0%
popularity

Publisher

unverified uploader

Provides an annotation for generating copy methods for Dart classes

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, meta

More

Packages that depend on copy_annotation