Adding blog post on A2UI client side functions - #13794
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new blog post explaining how to use A2UI's client-side functions to delegate local operations to Dart code on a user's device. The review feedback identifies several syntax and formatting issues within the markdown file, including an invalid Dart enum reference in a code snippet, a missing backtick, a typo in 'executeSync', an empty markdown link, and a broken link syntax at the end of the document.
|
Staged preview of the updated docs.flutter.dev site (updated for commit 9a06658): https://flutter-docs-prod--docs-pr13794-a2ui-client-side-funct-0p1n6v0y.web.app |
There was a problem hiding this comment.
Code Review
This pull request adds a new blog post detailing how to use A2UI's client-side functions in Flutter to run local operations on a user's device. The review feedback points out two key improvements: changing a Mermaid diagram's code block label from dart to mermaid to ensure correct rendering, and updating the validation logic in the Dart code snippet to check for quantity <= 0 instead of quantity < 1 so that fractional quantities are handled correctly.
| unnecessary network overhead, achieves consistent formatting, | ||
| and lowers overall token usage. | ||
|
|
||
| ```dart |
| if (quantity == null || quantity < 1) { | ||
| return '\$0.00'; | ||
| } |
There was a problem hiding this comment.
In a kitchen/catering context, ingredients are often measured in fractional quantities (e.g., 0.5 cups, 1.5 lbs). Checking quantity < 1 will incorrectly return $0.00 for any fractional quantity less than 1. Consider checking quantity <= 0 instead.
| if (quantity == null || quantity < 1) { | |
| return '\$0.00'; | |
| } | |
| if (quantity == null || quantity <= 0) { | |
| return '\$0.00'; | |
| } |
Reverts #13794 because the image files are missing.
As it says. Waiting for header image.