[mustache_template] Add example app and code excerpts#11466
[mustache_template] Add example app and code excerpts#11466HibaChamkhi wants to merge 7 commits intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a Flutter example application for the mustache_template package and refactors the README.md to utilize code excerpts from the new example. Additionally, the package is removed from the excerpt exclusion list, and the version is bumped to 2.0.5. Feedback suggests making the changelog entry more descriptive regarding the specific features demonstrated by the example app.
| @@ -1,3 +1,8 @@ | |||
| ## 2.0.5 | |||
|
|
|||
| * Adds example app. | |||
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Thanks for the contribution!
Please look over the review feedback on the previous attempted PRs that referenced this issue, and make sure that your PR addresses all of that feedback. For instance, this PR significantly rewrites the README in ways that have nothing to do with the issue, which as discussed previously is not in scope for this PR, and this also doesn't have meaningful tests, as was flagged in several previous PRs.
Also, as this package does not have a Flutter dependency, the example app should be a Dart script, not a Flutter app.
|
Thanks for the feedback! I've addressed the review comments:
|
stuartmorgan-g
left a comment
There was a problem hiding this comment.
and this also doesn't have meaningful tests, as was flagged in several previous PRs
This has not been addressed in the PR update; there is still nothing ensuring that the excerpts run as expected.
| var t = Template('{{# foo }}{{bar}}{{/ foo }}'); | ||
| var lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>'; | ||
| t.renderString({'foo': lambda, 'bar': 'pub'}); // <b>PUB</b> | ||
| ``` |
There was a problem hiding this comment.
Why are these examples removed?
There was a problem hiding this comment.
@stuartmorgan-g Both issues fixed:
- Lambda examples restored in README (both renderString and renderSource examples with var syntax)
- Added test/example_test.dart with 5 tests ensuring all README excerpts run correctly
There was a problem hiding this comment.
with var syntax
Code excerpts need to follow our style. The source file should not be overriding any style rules other than avoid_print.
There was a problem hiding this comment.
@stuartmorgan-g fixed:
1- Lambda examples restored in README
2- Added test/example_test.dart
3- Following style guidelines (only ignoring avoid_print)
- Use final instead of var in example code - Add proper type annotations (Object) for non-obvious types - Only ignore avoid_print lint rule as required - Update README excerpts to reflect proper style
Adds an example app for the
mustache_templatepackage, adds code excerpts,and removes the package from
script/configs/temp_exclude_excerpt.yaml.Fixes flutter/flutter#183936