Created by: noordawod
This has been on our to-do lists for quite a while now, but here it is finally: The null-safe version of Dart2 template.
The Mustache templates changed of course, and during testing few bugs were also uncovered. In particular, default values weren't injected properly in the template and now they are. In addition, sometimes the template wasn't testing for the correct parameter and mixing required
, defaultValue
and isNullable
. This has also been addressed in few places and tallies now with other templates, for example Kotlin's.
In some cases, however, where the user should have provided a default value (but possibly forgot to do so), I have included a friendly notice which hints to the user about the need to add a default value. This has actually helped me personally uncover a few places where I forgot to do so... Quite a nice hint I think.
Due to the introduction of null safety, deserialization becomes an even stricter endeavor. I have added assert()
clauses therefore in order to ensure that when in testing in development, the developer can see the errors and the offending keys.
I have a big project using this updated template, and have tested the app thoroughly to make sure it continues to work.
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
Run the following to build the project and update samples: ./mvnw clean package ./bin/generate-samples.sh ./bin/utils/export_docs_generators.sh
./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
(5.3.0),6.0.x
-
If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.
@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m @wing328 @jaumard @josh-burton @amondnet @sbu-WBT @kuhnroyal @agilob @ahmednfwela