Skip to content

[mustache_template] Add example app and code excerpts#23

Open
HibaChamkhi wants to merge 4 commits into
flutter:mainfrom
HibaChamkhi:fix/mustache-template-example
Open

[mustache_template] Add example app and code excerpts#23
HibaChamkhi wants to merge 4 commits into
flutter:mainfrom
HibaChamkhi:fix/mustache-template-example

Conversation

@HibaChamkhi

Copy link
Copy Markdown

Adds an example app for the mustache_template package, adds code excerpts to the README, and updates the CHANGELOG.

Fixes flutter/flutter#183936

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +39 to +40
final template =
Template('{{> partial-name }}', partialResolver: resolver);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
final template =
Template('{{> partial-name }}', partialResolver: resolver);
final template = Template('{{> partial-name }}', partialResolver: resolver);
References
  1. Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)

Comment on lines +57 to +58
final output =
template.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)

Comment on lines +55 to +56
final lambda = (LambdaContext ctx) => '<b>${ctx.renderString().toUpperCase()}</b>';
final output = template.renderString({'foo': lambda, 'bar': 'pub'}); // <b>PUB</b>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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
  1. Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)

Comment on lines +64 to +65
final lambda = (LambdaContext ctx) => ctx.renderSource(ctx.source + ' {{cmd}}');
final output = template.renderString({'foo': lambda, 'bar': 'pub', 'cmd': 'build'}); // pub build

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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
  1. Code should follow the Flutter style guide, and use the Dart auto-formatter. (link)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[mustache_template] No example app

1 participant