Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Buildrunner #130

Open
wants to merge 35 commits into
base: develop
Choose a base branch
from
Open

Buildrunner #130

wants to merge 35 commits into from

Conversation

Leptopoda
Copy link

@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