@@ -10,6 +10,7 @@ syntax inside of the dartdoc comment for a Flutter class/variable/enum/etc.:
1010/// above" or "see the code below", since the location of the description may
1111/// change in the future. You can use dartdoc [Linking] in the description, and
1212/// __Markdown__ too.
13+ ///
1314/// ```dart preamble
1415/// class Foo extends StatelessWidget {
1516/// const Foo({this.value = ''});
@@ -48,9 +49,17 @@ additional burden, since all code will also be compiled to be sure it compiles).
4849The templates available for using as an argument to the snippets tool are as
4950follows:
5051
51- - __ ` stateful_widget ` __ : Takes a ` preamble ` in addition to the default code
52+ - [ ` stateful_widget ` ] ( stateful_widget.tmpl ) :
53+ The default code block will be placed as the body of the ` State ` object of a
54+ StatefulWidget subclass. Because the default code block is placed as the body
55+ of a stateful widget, you will need to implement the ` build() ` function, and any
56+ state variables. It also has a ` preamble ` in addition to the default code
5257 block, which will be placed at the top level of the Dart file, so bare
53- function calls are not allowed in the preamble. The default code block is
54- placed as the body of a stateful widget, so you will need to implement the
55- build() function, and any state variables.
56-
58+ function calls are not allowed in the preamble. It also has an ` imports `
59+ section to import additional packages. Please only import things that are part
60+ of flutter or part of default dependencies for a ` flutter create ` project.
61+
62+ - [ ` stateless_widget ` ] ( stateless_widget.tmpl ) :
63+ Identical to the ` stateful_widget ` template, except that the default code
64+ block is inserted as the return value for a pre-existing ` build ` function in a
65+ StatelessWidget, instead of being at the class level.
0 commit comments