From e9230bada5cf17f4d2c32e203712eabc58ec395e Mon Sep 17 00:00:00 2001 From: Youssef Attia <16466991+youssef-attia@users.noreply.github.com> Date: Mon, 6 Jun 2022 13:24:00 -0700 Subject: [PATCH] Small typo with text on the source of an example text file (#105326) * Small typo with text on the source of an example text file * Added short paragraph on example location * Keep line length around 80 chars * Moved description of adding tests to a different paragraph * Removed whitespace * small 80 chars fix * small 80 chars fix * fixed col length * trailing whitespace --- examples/api/README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/examples/api/README.md b/examples/api/README.md index 07574a2b3068..6e670b783512 100644 --- a/examples/api/README.md +++ b/examples/api/README.md @@ -77,8 +77,14 @@ Use `{@tool dartpad}` for Dartpad examples, and use `{@tool sample}` for examples that shouldn't be run/shown in Dartpad. Once that comment block is inserted in the source code, create a new file at the -appropriate path under [`examples/api`](.). You should also add tests for your -sample code under [`examples/api/test`](./test). +appropriate path under [`examples/api`](.) that matches the location of the +source file they are linked from, and are named for the symbol they are attached +to, in lower_snake_case, with an index relating to their order within the doc +comment. So, for the `Curve2D` case, since it's in the `animation` package, in +a file called `curves.dart`, and it's the first example, it goes in +`examples/api/lib/animation/curves/curve2_d.0.dart`. + +You should also add tests for your sample code under [`examples/api/test`](./test). The entire example should be in a single file, so that Dartpad can load it. @@ -131,5 +137,5 @@ Tests go into a directory under [test](./test) that matches their location under `_test.dart` at the end, like other tests. For instance, a `LayoutBuilder` example that resides in [`lib/widgets/layout_builder/layout_builder.0.dart`]( ./lib/widgets/layout_builder/layout_builder.0.dart) would have its tests in a -file named [`test/animation/curves/curve2_d.0_test.dart`]( +file named [`test/widgets/layout_builder/layout_builder.0_test.dart`]( ./test/widgets/layout_builder/layout_builder.0_test.dart)