[mustache_template] Add example app and code excerpts#23
Conversation
There was a problem hiding this comment.
Code Review
This pull request adds an example application demonstrating basic templates, nested paths, partials, and lambdas, updates the README to use code excerpts from this example, and adds corresponding tests. The review feedback highlights several formatting issues in the newly added example and test files where lines exceed the 80-character limit or do not conform to the Dart auto-formatter.
| final template = | ||
| Template('{{> partial-name }}', partialResolver: resolver); |
There was a problem hiding this comment.
This line is not formatted correctly according to the Dart auto-formatter. It should be on a single line since it fits within the 80-character limit.
| final template = | |
| Template('{{> partial-name }}', partialResolver: resolver); | |
| final template = Template('{{> partial-name }}', partialResolver: resolver); |
References
- Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)
| final output = | ||
| template.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'}); |
There was a problem hiding this comment.
This line is not formatted correctly according to the Dart auto-formatter. It should be wrapped properly to adhere to the 80-character limit.
final output = template.renderString({
'foo': lambda,
'bar': 'pub',
'cmd': 'build',
});References
- Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)
| final lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>'; | ||
| final output = template.renderString({'foo': lambda, 'bar': 'pub'}); // <b>PUB</b> |
There was a problem hiding this comment.
This line exceeds the 80-character limit and is not formatted according to the Dart auto-formatter. Formatting this file is also important because the code excerpt tool will otherwise overwrite the formatted code in README.md with this unformatted version.
final lambda =
(LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>';
final output = template.renderString({
'foo': lambda,
'bar': 'pub',
}); // <b>PUB</b>References
- Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)
| final lambda = (LambdaContext ctx) => ctx.renderSource(ctx.source + ' {{cmd}}'); | ||
| final output = template.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'}); // pub build |
There was a problem hiding this comment.
These lines exceed the 80-character limit and are not formatted according to the Dart auto-formatter. Formatting this file is also important because the code excerpt tool will otherwise overwrite the formatted code in README.md with this unformatted version.
| final lambda = (LambdaContext ctx) => ctx.renderSource(ctx.source + ' {{cmd}}'); | |
| final output = template.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'}); // pub build | |
| final lambda = | |
| (LambdaContext ctx) => ctx.renderSource(ctx.source + ' {{cmd}}'); | |
| final output = template.renderString({ | |
| 'foo': lambda, | |
| 'bar': 'pub', | |
| 'cmd': 'build', | |
| }); // pub build |
References
- Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)
Adds an example app for the mustache_template package, adds code excerpts to the README, and updates the CHANGELOG.
Fixes flutter/flutter#183936