simple_copy_with_annotations 0.0.2 copy "simple_copy_with_annotations: ^0.0.2" to clipboard
simple_copy_with_annotations: ^0.0.2 copied to clipboard

generates a copywith method for classes marked @copywith annotation using build_runner

This package contains annotations for generate copywith method for any Dart classes #

Configure: #

Add in you pubspec.yaml to dependencies section:

dependencies:
  ...        
  simple_copy_with_annotations:
  ...        

and to dev_dependencies ( build_runner & copy_with_generators ):

dev_dependencies:
  ...
  build_runner:
  simple_copy_with_generators:
  ...

Use: #

Annotate you class copywith annotation. Like this:

part 'profile_model.g.dart';
@copywith
class ProfileModel {
    String _name = 'Aachman';
    int _age = 20;
    bool _codes = true;
}

after in console run this command:

 flutter pub run build_runner build 

and use:

 final ProfileModel profile = ProfileModel()
  ..name = 'Sergio'
  ..age = 35
  ..codes = true;

final newProfile = profile.copyWith(name: 'Michael');
1
likes
110
pub points
2%
popularity

Publisher

unverified uploader

generates a copywith method for classes marked @copywith annotation using build_runner

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

More

Packages that depend on simple_copy_with_annotations