File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/flutter/lib/src/material Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import 'theme.dart';
1111import 'theme_data.dart' ;
1212
1313// Examples can assume:
14+ // bool? _throwShotAway = false;
1415// void setState(VoidCallback fn) { }
1516
1617/// A [ListTile] with a [Checkbox] . In other words, a checkbox with a label.
@@ -163,21 +164,24 @@ class CheckboxListTile extends StatelessWidget {
163164 ///
164165 /// If null, the checkbox will be displayed as disabled.
165166 ///
167+ /// {@tool snippet}
168+ ///
166169 /// The callback provided to [onChanged] should update the state of the parent
167170 /// [StatefulWidget] using the [State.setState] method, so that the parent
168171 /// gets rebuilt; for example:
169172 ///
170173 /// ```dart
171174 /// CheckboxListTile(
172175 /// value: _throwShotAway,
173- /// onChanged: (bool newValue) {
176+ /// onChanged: (bool? newValue) {
174177 /// setState(() {
175178 /// _throwShotAway = newValue;
176179 /// });
177180 /// },
178- /// title: Text('Throw away your shot'),
181+ /// title: const Text('Throw away your shot'),
179182 /// )
180183 /// ```
184+ /// {@end-tool}
181185 final ValueChanged <bool ?>? onChanged;
182186
183187 /// The color to use when this checkbox is checked.
You can’t perform that action at this time.
0 commit comments