From 8c46968c620e126c686337d61960bcc2f28cf8e4 Mon Sep 17 00:00:00 2001 From: Kyosuke Takayama Date: Wed, 11 May 2022 01:04:09 +0900 Subject: [PATCH] fix compile error in the example code (#103261) --- packages/flutter/lib/src/material/checkbox_list_tile.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/flutter/lib/src/material/checkbox_list_tile.dart b/packages/flutter/lib/src/material/checkbox_list_tile.dart index 6a26302411..4ee9a2c06b 100644 --- a/packages/flutter/lib/src/material/checkbox_list_tile.dart +++ b/packages/flutter/lib/src/material/checkbox_list_tile.dart @@ -11,6 +11,7 @@ import 'theme.dart'; import 'theme_data.dart'; // Examples can assume: +// bool? _throwShotAway = false; // void setState(VoidCallback fn) { } /// A [ListTile] with a [Checkbox]. In other words, a checkbox with a label. @@ -163,6 +164,8 @@ class CheckboxListTile extends StatelessWidget { /// /// If null, the checkbox will be displayed as disabled. /// + /// {@tool snippet} + /// /// The callback provided to [onChanged] should update the state of the parent /// [StatefulWidget] using the [State.setState] method, so that the parent /// gets rebuilt; for example: @@ -170,14 +173,15 @@ class CheckboxListTile extends StatelessWidget { /// ```dart /// CheckboxListTile( /// value: _throwShotAway, - /// onChanged: (bool newValue) { + /// onChanged: (bool? newValue) { /// setState(() { /// _throwShotAway = newValue; /// }); /// }, - /// title: Text('Throw away your shot'), + /// title: const Text('Throw away your shot'), /// ) /// ``` + /// {@end-tool} final ValueChanged? onChanged; /// The color to use when this checkbox is checked.