diff --git a/packages/flutter/lib/src/cupertino/app.dart b/packages/flutter/lib/src/cupertino/app.dart index 0a3b4543af..1edee00923 100644 --- a/packages/flutter/lib/src/cupertino/app.dart +++ b/packages/flutter/lib/src/cupertino/app.dart @@ -13,9 +13,6 @@ import 'localizations.dart'; import 'route.dart'; import 'theme.dart'; -// Examples can assume: -// // @dart = 2.9 - /// An application that uses Cupertino design. /// /// A convenience widget that wraps a number of widgets that are commonly @@ -277,7 +274,7 @@ class CupertinoApp extends StatefulWidget { /// LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), /// }, /// color: const Color(0xFFFF0000), - /// builder: (BuildContext context, Widget child) { + /// builder: (BuildContext context, Widget? child) { /// return const Placeholder(); /// }, /// ); @@ -310,7 +307,7 @@ class CupertinoApp extends StatefulWidget { /// ), /// }, /// color: const Color(0xFFFF0000), - /// builder: (BuildContext context, Widget child) { + /// builder: (BuildContext context, Widget? child) { /// return const Placeholder(); /// }, /// ); diff --git a/packages/flutter/lib/src/cupertino/context_menu.dart b/packages/flutter/lib/src/cupertino/context_menu.dart index 2e218667fc..169ef22289 100644 --- a/packages/flutter/lib/src/cupertino/context_menu.dart +++ b/packages/flutter/lib/src/cupertino/context_menu.dart @@ -75,7 +75,7 @@ enum _ContextMenuLocation { /// child's corners and allowing its aspect ratio to expand, similar to the /// Photos app on iOS. /// -/// {@tool dartpad --template=stateless_widget_material_no_null_safety} +/// {@tool dartpad --template=stateless_widget_material} /// /// This sample shows a very simple CupertinoContextMenu for an empty red /// 100x100 Container. Simply long press on it to open. diff --git a/packages/flutter/lib/src/cupertino/search_field.dart b/packages/flutter/lib/src/cupertino/search_field.dart index a67fd70d4b..fe2202eb30 100644 --- a/packages/flutter/lib/src/cupertino/search_field.dart +++ b/packages/flutter/lib/src/cupertino/search_field.dart @@ -12,9 +12,6 @@ import 'icons.dart'; import 'localizations.dart'; import 'text_field.dart'; -// Examples can assume: -// // @dart = 2.9 - /// A [CupertinoTextField] that mimics the look and behavior of UIKit's /// `UISearchTextField`. /// @@ -35,7 +32,7 @@ import 'text_field.dart'; /// } /// /// class _MyPrefilledSearchState extends State { -/// TextEditingController _textController; +/// late TextEditingController _textController; /// /// @override /// void initState() { diff --git a/packages/flutter/lib/src/cupertino/slider.dart b/packages/flutter/lib/src/cupertino/slider.dart index 651c2422d7..4e6a826c94 100644 --- a/packages/flutter/lib/src/cupertino/slider.dart +++ b/packages/flutter/lib/src/cupertino/slider.dart @@ -14,7 +14,6 @@ import 'theme.dart'; import 'thumb_painter.dart'; // Examples can assume: -// // @dart = 2.9 // int _cupertinoSliderValue = 1; // void setState(VoidCallback fn) { } diff --git a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart index 5f49c456c0..a2b2416c3b 100644 --- a/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart +++ b/packages/flutter/lib/src/cupertino/sliding_segmented_control.dart @@ -12,9 +12,6 @@ import 'package:flutter/widgets.dart'; import 'colors.dart'; -// Examples can assume: -// // @dart = 2.9 - // Extracted from https://developer.apple.com/design/resources/. // Minimum padding from edges of the segmented control to edges of @@ -197,14 +194,14 @@ class CupertinoSlidingSegmentedControl extends StatefulWidget { /// 1: Text('Child 2'), /// }; /// - /// int currentValue; + /// int? currentValue; /// /// @override /// Widget build(BuildContext context) { /// return Container( /// child: CupertinoSlidingSegmentedControl( /// children: children, - /// onValueChanged: (int newValue) { + /// onValueChanged: (int? newValue) { /// setState(() { /// currentValue = newValue; /// }); diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index 7d65313ace..e70362489d 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -14,8 +14,7 @@ import 'colors.dart'; import 'thumb_painter.dart'; // Examples can assume: -// // @dart = 2.9 -// bool _lights; +// bool _lights = false; // void setState(VoidCallback fn) { } /// An iOS-style switch. diff --git a/packages/flutter/lib/src/cupertino/text_form_field_row.dart b/packages/flutter/lib/src/cupertino/text_form_field_row.dart index 21ef9730d4..74176a8d73 100644 --- a/packages/flutter/lib/src/cupertino/text_form_field_row.dart +++ b/packages/flutter/lib/src/cupertino/text_form_field_row.dart @@ -11,9 +11,6 @@ import 'form_row.dart'; import 'text_field.dart'; import 'theme.dart'; -// Examples can assume: -// // @dart = 2.9 - /// Creates a [CupertinoFormRow] containing a [FormField] that wraps /// a [CupertinoTextField]. /// @@ -64,18 +61,18 @@ import 'theme.dart'; /// ```dart /// CupertinoTextFormFieldRow( /// prefix: Text('Username'), -/// onSaved: (String value) { +/// onSaved: (String? value) { /// // This optional block of code can be used to run /// // code when the user saves the form. /// }, -/// validator: (String value) { -/// return value.contains('@') ? 'Do not use the @ char.' : null; +/// validator: (String? value) { +/// return (value != null && value.contains('@')) ? 'Do not use the @ char.' : null; /// }, /// ) /// ``` /// {@end-tool} /// -/// {@tool dartpad --template=stateful_widget_material_no_null_safety} +/// {@tool dartpad --template=stateful_widget_material} /// This example shows how to move the focus to the next field when the user /// presses the SPACE key. /// @@ -90,7 +87,7 @@ import 'theme.dart'; /// child: Form( /// autovalidateMode: AutovalidateMode.always, /// onChanged: () { -/// Form.of(primaryFocus.context).save(); +/// Form.of(primaryFocus!.context!)?.save(); /// }, /// child: CupertinoFormSection.insetGrouped( /// header: Text('SECTION 1'), @@ -99,7 +96,7 @@ import 'theme.dart'; /// prefix: Text('Enter text'), /// placeholder: 'Enter text', /// validator: (value) { -/// if (value.isEmpty) { +/// if (value == null || value.isEmpty) { /// return 'Please enter a value'; /// } /// return null;