Skip to content

Buildrunner#130

Open
Leptopoda wants to merge 35 commits into
Bennik2000:developfrom
Leptopoda:buildrunner
Open

Buildrunner#130
Leptopoda wants to merge 35 commits into
Bennik2000:developfrom
Leptopoda:buildrunner

Conversation

@Leptopoda
Copy link
Copy Markdown

@Leptopoda Leptopoda commented Oct 15, 2022

Facilitate buildrunner for generating dart code for us.

Buildrunner is a dart package that can be extended for procedural code generation. This PR implements it for the serialization of objects, generating copyWith methods and generating asset binding.

  • Serialization json_serializable will generate toJson and fromJson methods for annotated classes.
  • copywith copy_with_extension_gen will generate copyWith methods
  • AssetGen assets_gen will generate assets.dart containing all filenames of bundled assets. This can ease the change of filenames/paths.

All generated code is likely better null aware and can reduce bugs while easing the coding. adding the serialization capability to the our objects eliminates the use of *Entity classes.

Generated code is in lib/assets.dart and for classes in class_name.g.dart next to the class in general.
To run the buildrunner use flutter pub run build_runner build. Currently the generated code is checked into the git repo to ease the first use dev experience although they could be removed.

This PR is based on the lining branch wich itself is based on the nullsafety one. They need to be reviewed first.

@Leptopoda Leptopoda marked this pull request as ready for review October 15, 2022 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant