docs: move fillRandomBytes example to a separate file - #354
Open
LALITH0110 wants to merge 1 commit into
Open
Conversation
Moves the `fillRandomBytes` dartdoc example into
`example/webcrypto/random/fill_random_bytes.dart` and references it with
`{@example ...}`, so the example is covered by `dart analyze` and
`dart format` instead of living inside a doc comment.
The example code is unchanged from what the documentation already showed.
`avoid_print` is suppressed for the file because the example prints its
result, matching how the docs demonstrate it.
Towards google#283
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
@googlebot I signed it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Towards #283 — one primitive per PR, as requested in the issue.
Moves the
fillRandomBytesexample out of its dartdoc comment and intoexample/webcrypto/random/fill_random_bytes.dart, referenced with{@example /example/webcrypto/random/fill_random_bytes.dart#example}. This follows the shape of #293 (HMACimportRawKey).The example code itself is unchanged from what the docs already showed — it was copied verbatim. The only additions are the license header, the
#region/#endregionmarkers, and oneignore_for_file.Note on
avoid_printThe example prints its result, and
example/webcrypto/is not excluded from analysis, soflutter_lints'avoid_printfires on it once the code leaves the doc comment. I've added// ignore_for_file: avoid_printrather than change what the example demonstrates, since printing the random bytes is the point of it.Happy to drop the
printand the ignore instead if you'd prefer examples to be lint-clean without suppressions — that would mean the rendered docs differ slightly from today's.Verification
Run with Dart 3.12.2 (the repo requires
^3.10.0):dart analyze example/webcrypto lib→ No issues founddart format --output=none --set-exit-if-changedon both changed files → 0 changedignore_for_fileline temporarily to confirm the suppression is actually load-bearing →avoid_printfires, as expectedAI disclosure: this change was drafted with AI assistance. I reviewed it, and the verification above (including the negative test for the lint suppression) was run locally before opening the PR.