Unverified Commit a6117269 authored by Darren Austin's avatar Darren Austin Committed by GitHub

Migrated some services and widgets doc comments to null safety. (#72792)

parent 6118eaa0
...@@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable {
/// // The node used to request the keyboard focus. /// // The node used to request the keyboard focus.
/// final FocusNode _focusNode = FocusNode(); /// final FocusNode _focusNode = FocusNode();
/// // The message to display. /// // The message to display.
/// String _message; /// String? _message;
/// ///
/// // Focus nodes need to be disposed. /// // Focus nodes need to be disposed.
/// @override /// @override
...@@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable {
/// _message = 'Pressed the "Q" key!'; /// _message = 'Pressed the "Q" key!';
/// } else { /// } else {
/// if (kReleaseMode) { /// if (kReleaseMode) {
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? '<none>'}"'; /// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel}"';
/// } else { /// } else {
/// // This will only print useful information in debug mode. /// // This will only print useful information in debug mode.
/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}'; /// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}';
...@@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable {
/// color: Colors.white, /// color: Colors.white,
/// alignment: Alignment.center, /// alignment: Alignment.center,
/// child: DefaultTextStyle( /// child: DefaultTextStyle(
/// style: textTheme.headline4, /// style: textTheme.headline4!,
/// child: RawKeyboardListener( /// child: RawKeyboardListener(
/// focusNode: _focusNode, /// focusNode: _focusNode,
/// onKey: _handleKeyEvent, /// onKey: _handleKeyEvent,
/// child: AnimatedBuilder( /// child: AnimatedBuilder(
/// animation: _focusNode, /// animation: _focusNode,
/// builder: (BuildContext context, Widget child) { /// builder: (BuildContext context, Widget? child) {
/// if (!_focusNode.hasFocus) { /// if (!_focusNode.hasFocus) {
/// return GestureDetector( /// return GestureDetector(
/// onTap: () { /// onTap: () {
...@@ -346,7 +346,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -346,7 +346,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// // The node used to request the keyboard focus. /// // The node used to request the keyboard focus.
/// final FocusNode _focusNode = FocusNode(); /// final FocusNode _focusNode = FocusNode();
/// // The message to display. /// // The message to display.
/// String _message; /// String? _message;
/// ///
/// // Focus nodes need to be disposed. /// // Focus nodes need to be disposed.
/// @override /// @override
...@@ -374,13 +374,13 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -374,13 +374,13 @@ class LogicalKeyboardKey extends KeyboardKey {
/// color: Colors.white, /// color: Colors.white,
/// alignment: Alignment.center, /// alignment: Alignment.center,
/// child: DefaultTextStyle( /// child: DefaultTextStyle(
/// style: textTheme.headline4, /// style: textTheme.headline4!,
/// child: RawKeyboardListener( /// child: RawKeyboardListener(
/// focusNode: _focusNode, /// focusNode: _focusNode,
/// onKey: _handleKeyEvent, /// onKey: _handleKeyEvent,
/// child: AnimatedBuilder( /// child: AnimatedBuilder(
/// animation: _focusNode, /// animation: _focusNode,
/// builder: (BuildContext context, Widget child) { /// builder: (BuildContext context, Widget? child) {
/// if (!_focusNode.hasFocus) { /// if (!_focusNode.hasFocus) {
/// return GestureDetector( /// return GestureDetector(
/// onTap: () { /// onTap: () {
......
...@@ -45,7 +45,7 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -45,7 +45,7 @@ abstract class KeyboardKey with Diagnosticable {
/// look at the physical key to make sure that regardless of the character the /// look at the physical key to make sure that regardless of the character the
/// key produces, you got the key that is in that location on the keyboard. /// key produces, you got the key that is in that location on the keyboard.
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold}
/// This example shows how to detect if the user has selected the logical "Q" /// This example shows how to detect if the user has selected the logical "Q"
/// key. /// key.
/// ///
...@@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -58,7 +58,7 @@ abstract class KeyboardKey with Diagnosticable {
/// // The node used to request the keyboard focus. /// // The node used to request the keyboard focus.
/// final FocusNode _focusNode = FocusNode(); /// final FocusNode _focusNode = FocusNode();
/// // The message to display. /// // The message to display.
/// String _message; /// String? _message;
/// ///
/// // Focus nodes need to be disposed. /// // Focus nodes need to be disposed.
/// @override /// @override
...@@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -75,7 +75,7 @@ abstract class KeyboardKey with Diagnosticable {
/// _message = 'Pressed the "Q" key!'; /// _message = 'Pressed the "Q" key!';
/// } else { /// } else {
/// if (kReleaseMode) { /// if (kReleaseMode) {
/// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel ?? '<none>'}"'; /// _message = 'Not a Q: Key label is "${event.logicalKey.keyLabel}"';
/// } else { /// } else {
/// // This will only print useful information in debug mode. /// // This will only print useful information in debug mode.
/// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}'; /// _message = 'Not a Q: Pressed ${event.logicalKey.debugName}';
...@@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable { ...@@ -91,13 +91,13 @@ abstract class KeyboardKey with Diagnosticable {
/// color: Colors.white, /// color: Colors.white,
/// alignment: Alignment.center, /// alignment: Alignment.center,
/// child: DefaultTextStyle( /// child: DefaultTextStyle(
/// style: textTheme.headline4, /// style: textTheme.headline4!,
/// child: RawKeyboardListener( /// child: RawKeyboardListener(
/// focusNode: _focusNode, /// focusNode: _focusNode,
/// onKey: _handleKeyEvent, /// onKey: _handleKeyEvent,
/// child: AnimatedBuilder( /// child: AnimatedBuilder(
/// animation: _focusNode, /// animation: _focusNode,
/// builder: (BuildContext context, Widget child) { /// builder: (BuildContext context, Widget? child) {
/// if (!_focusNode.hasFocus) { /// if (!_focusNode.hasFocus) {
/// return GestureDetector( /// return GestureDetector(
/// onTap: () { /// onTap: () {
...@@ -1987,7 +1987,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -1987,7 +1987,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// looking for "the key next next to the TAB key", since on a French keyboard, /// looking for "the key next next to the TAB key", since on a French keyboard,
/// the key next to the TAB key has an "A" on it. /// the key next to the TAB key has an "A" on it.
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold}
/// This example shows how to detect if the user has selected the physical key /// This example shows how to detect if the user has selected the physical key
/// to the right of the CAPS LOCK key. /// to the right of the CAPS LOCK key.
/// ///
...@@ -1999,7 +1999,7 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -1999,7 +1999,7 @@ class LogicalKeyboardKey extends KeyboardKey {
/// // The node used to request the keyboard focus. /// // The node used to request the keyboard focus.
/// final FocusNode _focusNode = FocusNode(); /// final FocusNode _focusNode = FocusNode();
/// // The message to display. /// // The message to display.
/// String _message; /// String? _message;
/// ///
/// // Focus nodes need to be disposed. /// // Focus nodes need to be disposed.
/// @override /// @override
...@@ -2027,13 +2027,13 @@ class LogicalKeyboardKey extends KeyboardKey { ...@@ -2027,13 +2027,13 @@ class LogicalKeyboardKey extends KeyboardKey {
/// color: Colors.white, /// color: Colors.white,
/// alignment: Alignment.center, /// alignment: Alignment.center,
/// child: DefaultTextStyle( /// child: DefaultTextStyle(
/// style: textTheme.headline4, /// style: textTheme.headline4!,
/// child: RawKeyboardListener( /// child: RawKeyboardListener(
/// focusNode: _focusNode, /// focusNode: _focusNode,
/// onKey: _handleKeyEvent, /// onKey: _handleKeyEvent,
/// child: AnimatedBuilder( /// child: AnimatedBuilder(
/// animation: _focusNode, /// animation: _focusNode,
/// builder: (BuildContext context, Widget child) { /// builder: (BuildContext context, Widget? child) {
/// if (!_focusNode.hasFocus) { /// if (!_focusNode.hasFocus) {
/// return GestureDetector( /// return GestureDetector(
/// onTap: () { /// onTap: () {
......
...@@ -12,9 +12,6 @@ import 'binding.dart'; ...@@ -12,9 +12,6 @@ import 'binding.dart';
import 'message_codec.dart'; import 'message_codec.dart';
import 'message_codecs.dart'; import 'message_codecs.dart';
// Examples can assume:
// // @dart = 2.9
/// A named channel for communicating with platform plugins using asynchronous /// A named channel for communicating with platform plugins using asynchronous
/// message passing. /// message passing.
/// ///
...@@ -196,9 +193,9 @@ class MethodChannel { ...@@ -196,9 +193,9 @@ class MethodChannel {
/// static const MethodChannel _channel = MethodChannel('music'); /// static const MethodChannel _channel = MethodChannel('music');
/// ///
/// static Future<bool> isLicensed() async { /// static Future<bool> isLicensed() async {
/// // invokeMethod returns a Future<T> which can be inferred as bool /// // invokeMethod returns a Future<T?>, so we handle the case where
/// // in this context. /// // the return value is null by treating null as false.
/// return _channel.invokeMethod('isLicensed'); /// return _channel.invokeMethod<bool>('isLicensed').then<bool>((bool? value) => value ?? false);
/// } /// }
/// ///
/// static Future<List<Song>> songs() async { /// static Future<List<Song>> songs() async {
......
...@@ -344,7 +344,7 @@ class SystemChrome { ...@@ -344,7 +344,7 @@ class SystemChrome {
/// navigation bar and synthesize them into a single style. This can be used /// navigation bar and synthesize them into a single style. This can be used
/// to configure the system styles when an app bar is not used. /// to configure the system styles when an app bar is not used.
/// ///
/// {@tool sample --template=stateful_widget_material_no_null_safety} /// {@tool sample --template=stateful_widget_material}
/// The following example creates a widget that changes the status bar color /// The following example creates a widget that changes the status bar color
/// to a random value on Android. /// to a random value on Android.
/// ///
......
...@@ -11,8 +11,7 @@ import 'ticker_provider.dart'; ...@@ -11,8 +11,7 @@ import 'ticker_provider.dart';
import 'transitions.dart'; import 'transitions.dart';
// Examples can assume: // Examples can assume:
// // @dart = 2.9 // bool _first = false;
// bool _first;
/// Specifies which of two children to show. See [AnimatedCrossFade]. /// Specifies which of two children to show. See [AnimatedCrossFade].
/// ///
......
This diff is collapsed.
...@@ -48,11 +48,10 @@ export 'package:flutter/gestures.dart' show ...@@ -48,11 +48,10 @@ export 'package:flutter/gestures.dart' show
export 'package:flutter/rendering.dart' show RenderSemanticsGestureHandler; export 'package:flutter/rendering.dart' show RenderSemanticsGestureHandler;
// Examples can assume: // Examples can assume:
// // @dart = 2.9 // late bool _lights;
// bool _lights;
// void setState(VoidCallback fn) { } // void setState(VoidCallback fn) { }
// String _last; // late String _last;
// Color _color; // late Color _color;
/// Factory for creating gesture recognizers. /// Factory for creating gesture recognizers.
/// ///
...@@ -1045,8 +1044,8 @@ class RawGestureDetector extends StatefulWidget { ...@@ -1045,8 +1044,8 @@ class RawGestureDetector extends StatefulWidget {
/// ```dart /// ```dart
/// class ForcePressGestureDetectorWithSemantics extends StatelessWidget { /// class ForcePressGestureDetectorWithSemantics extends StatelessWidget {
/// const ForcePressGestureDetectorWithSemantics({ /// const ForcePressGestureDetectorWithSemantics({
/// this.child, /// required this.child,
/// this.onForcePress, /// required this.onForcePress,
/// }); /// });
/// ///
/// final Widget child; /// final Widget child;
......
...@@ -762,7 +762,7 @@ class Image extends StatefulWidget { ...@@ -762,7 +762,7 @@ class Image extends StatefulWidget {
/// ``` /// ```
/// {@endtemplate} /// {@endtemplate}
/// ///
/// {@tool dartpad --template=stateless_widget_material_no_null_safety} /// {@tool dartpad --template=stateless_widget_material}
/// ///
/// The following sample demonstrates how to use this builder to implement an /// The following sample demonstrates how to use this builder to implement an
/// image that fades in once it's been loaded. /// image that fades in once it's been loaded.
...@@ -781,8 +781,8 @@ class Image extends StatefulWidget { ...@@ -781,8 +781,8 @@ class Image extends StatefulWidget {
/// ), /// ),
/// child: Image.network( /// child: Image.network(
/// 'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg', /// 'https://flutter.github.io/assets-for-api-docs/assets/widgets/puffin.jpg',
/// frameBuilder: (BuildContext context, Widget child, int frame, bool wasSynchronouslyLoaded) { /// frameBuilder: (BuildContext context, Widget child, int? frame, bool? wasSynchronouslyLoaded) {
/// if (wasSynchronouslyLoaded) { /// if (wasSynchronouslyLoaded ?? false) {
/// return child; /// return child;
/// } /// }
/// return AnimatedOpacity( /// return AnimatedOpacity(
...@@ -828,7 +828,7 @@ class Image extends StatefulWidget { ...@@ -828,7 +828,7 @@ class Image extends StatefulWidget {
/// ///
/// {@macro flutter.widgets.Image.frameBuilder.chainedBuildersExample} /// {@macro flutter.widgets.Image.frameBuilder.chainedBuildersExample}
/// ///
/// {@tool dartpad --template=stateless_widget_material_no_null_safety} /// {@tool dartpad --template=stateless_widget_material}
/// ///
/// The following sample uses [loadingBuilder] to show a /// The following sample uses [loadingBuilder] to show a
/// [CircularProgressIndicator] while an image loads over the network. /// [CircularProgressIndicator] while an image loads over the network.
...@@ -843,13 +843,13 @@ class Image extends StatefulWidget { ...@@ -843,13 +843,13 @@ class Image extends StatefulWidget {
/// ), /// ),
/// child: Image.network( /// child: Image.network(
/// 'https://example.com/image.jpg', /// 'https://example.com/image.jpg',
/// loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent loadingProgress) { /// loadingBuilder: (BuildContext context, Widget child, ImageChunkEvent? loadingProgress) {
/// if (loadingProgress == null) /// if (loadingProgress == null)
/// return child; /// return child;
/// return Center( /// return Center(
/// child: CircularProgressIndicator( /// child: CircularProgressIndicator(
/// value: loadingProgress.expectedTotalBytes != null /// value: loadingProgress.expectedTotalBytes != null
/// ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes /// ? loadingProgress.cumulativeBytesLoaded / loadingProgress.expectedTotalBytes!
/// : null, /// : null,
/// ), /// ),
/// ); /// );
...@@ -873,7 +873,7 @@ class Image extends StatefulWidget { ...@@ -873,7 +873,7 @@ class Image extends StatefulWidget {
/// [FlutterError.onError]. If it is provided, the caller should either handle /// [FlutterError.onError]. If it is provided, the caller should either handle
/// the exception by providing a replacement widget, or rethrow the exception. /// the exception by providing a replacement widget, or rethrow the exception.
/// ///
/// {@tool dartpad --template=stateless_widget_material_no_null_safety} /// {@tool dartpad --template=stateless_widget_material}
/// ///
/// The following sample uses [errorBuilder] to show a '😢' in place of the /// The following sample uses [errorBuilder] to show a '😢' in place of the
/// image that fails to load, and prints the error to the console. /// image that fails to load, and prints the error to the console.
...@@ -888,7 +888,7 @@ class Image extends StatefulWidget { ...@@ -888,7 +888,7 @@ class Image extends StatefulWidget {
/// ), /// ),
/// child: Image.network( /// child: Image.network(
/// 'https://example.does.not.exist/image.jpg', /// 'https://example.does.not.exist/image.jpg',
/// errorBuilder: (BuildContext context, Object exception, StackTrace stackTrace) { /// errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
/// // Appropriate logging or analytics, e.g. /// // Appropriate logging or analytics, e.g.
/// // myAnalytics.recordError( /// // myAnalytics.recordError(
/// // 'An error occurred loading "https://example.does.not.exist/image.jpg"', /// // 'An error occurred loading "https://example.does.not.exist/image.jpg"',
......
...@@ -19,7 +19,6 @@ import 'ticker_provider.dart'; ...@@ -19,7 +19,6 @@ import 'ticker_provider.dart';
import 'transitions.dart'; import 'transitions.dart';
// Examples can assume: // Examples can assume:
// // @dart = 2.9
// class MyWidget extends ImplicitlyAnimatedWidget { // class MyWidget extends ImplicitlyAnimatedWidget {
// MyWidget() : super(duration: const Duration(seconds: 1)); // MyWidget() : super(duration: const Duration(seconds: 1));
// final Color targetColor = Colors.black; // final Color targetColor = Colors.black;
...@@ -480,14 +479,14 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget> ...@@ -480,14 +479,14 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
/// ///
/// ```dart /// ```dart
/// class MyWidgetState extends AnimatedWidgetBaseState<MyWidget> { /// class MyWidgetState extends AnimatedWidgetBaseState<MyWidget> {
/// ColorTween _colorTween; /// ColorTween? _colorTween;
/// ///
/// @override /// @override
/// Widget build(BuildContext context) { /// Widget build(BuildContext context) {
/// return Text( /// return Text(
/// 'Hello World', /// 'Hello World',
/// // Computes the value of the text color at any given time. /// // Computes the value of the text color at any given time.
/// style: TextStyle(color: _colorTween.evaluate(animation)), /// style: TextStyle(color: _colorTween?.evaluate(animation)),
/// ); /// );
/// } /// }
/// ///
...@@ -502,7 +501,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget> ...@@ -502,7 +501,7 @@ abstract class ImplicitlyAnimatedWidgetState<T extends ImplicitlyAnimatedWidget>
/// // A function that takes a color value and returns a tween /// // A function that takes a color value and returns a tween
/// // beginning at that value. /// // beginning at that value.
/// (value) => ColorTween(begin: value), /// (value) => ColorTween(begin: value),
/// ); /// ) as ColorTween?;
/// ///
/// // We could have more tweens than one by using the visitor /// // We could have more tweens than one by using the visitor
/// // multiple times. /// // multiple times.
...@@ -573,7 +572,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten ...@@ -573,7 +572,7 @@ abstract class AnimatedWidgetBaseState<T extends ImplicitlyAnimatedWidget> exten
/// ///
/// {@youtube 560 315 https://www.youtube.com/watch?v=yI-8QHpGIP4} /// {@youtube 560 315 https://www.youtube.com/watch?v=yI-8QHpGIP4}
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold}
/// ///
/// The following example (depicted above) transitions an AnimatedContainer /// The following example (depicted above) transitions an AnimatedContainer
/// between two states. It adjusts the `height`, `width`, `color`, and /// between two states. It adjusts the `height`, `width`, `color`, and
...@@ -812,7 +811,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer> ...@@ -812,7 +811,7 @@ class _AnimatedContainerState extends AnimatedWidgetBaseState<AnimatedContainer>
/// of [Curves.fastOutSlowIn]. /// of [Curves.fastOutSlowIn].
/// {@animation 250 266 https://flutter.github.io/assets-for-api-docs/assets/widgets/animated_padding.mp4} /// {@animation 250 266 https://flutter.github.io/assets-for-api-docs/assets/widgets/animated_padding.mp4}
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold}
/// ///
/// The following code implements the [AnimatedPadding] widget, using a [curve] of /// The following code implements the [AnimatedPadding] widget, using a [curve] of
/// [Curves.easeInOut]. /// [Curves.easeInOut].
...@@ -933,7 +932,7 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState<AnimatedPadding> { ...@@ -933,7 +932,7 @@ class _AnimatedPaddingState extends AnimatedWidgetBaseState<AnimatedPadding> {
/// it also requires more development overhead as you have to manually manage /// it also requires more development overhead as you have to manually manage
/// the lifecycle of the underlying [AnimationController]. /// the lifecycle of the underlying [AnimationController].
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold}
/// ///
/// The following code implements the [AnimatedAlign] widget, using a [curve] of /// The following code implements the [AnimatedAlign] widget, using a [curve] of
/// [Curves.fastOutSlowIn]. /// [Curves.fastOutSlowIn].
...@@ -1098,7 +1097,7 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> { ...@@ -1098,7 +1097,7 @@ class _AnimatedAlignState extends AnimatedWidgetBaseState<AnimatedAlign> {
/// it also requires more development overhead as you have to manually manage /// it also requires more development overhead as you have to manually manage
/// the lifecycle of the underlying [AnimationController]. /// the lifecycle of the underlying [AnimationController].
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_center_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold_center}
/// ///
/// The following example transitions an AnimatedPositioned /// The following example transitions an AnimatedPositioned
/// between two states. It adjusts the `height`, `width`, and /// between two states. It adjusts the `height`, `width`, and
...@@ -1550,7 +1549,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit ...@@ -1550,7 +1549,7 @@ class _AnimatedOpacityState extends ImplicitlyAnimatedWidgetState<AnimatedOpacit
/// Here's an illustration of what using this widget looks like, using a [curve] /// Here's an illustration of what using this widget looks like, using a [curve]
/// of [Curves.fastOutSlowIn]. /// of [Curves.fastOutSlowIn].
/// ///
/// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state_no_null_safety} /// {@tool dartpad --template=stateful_widget_scaffold_center_freeform_state}
/// Creates a [CustomScrollView] with a [SliverFixedExtentList] and a /// Creates a [CustomScrollView] with a [SliverFixedExtentList] and a
/// [FloatingActionButton]. Pressing the button animates the lists' opacity. /// [FloatingActionButton]. Pressing the button animates the lists' opacity.
/// ///
......
...@@ -10,9 +10,6 @@ import 'package:flutter/services.dart'; ...@@ -10,9 +10,6 @@ import 'package:flutter/services.dart';
import 'editable_text.dart'; import 'editable_text.dart';
import 'restoration.dart'; import 'restoration.dart';
// Examples can assume:
// // @dart = 2.9
/// A [RestorableProperty] that makes the wrapped value accessible to the owning /// A [RestorableProperty] that makes the wrapped value accessible to the owning
/// [State] object via the [value] getter and setter. /// [State] object via the [value] getter and setter.
/// ///
...@@ -22,7 +19,7 @@ import 'restoration.dart'; ...@@ -22,7 +19,7 @@ import 'restoration.dart';
/// ///
/// ## Using a RestorableValue /// ## Using a RestorableValue
/// ///
/// {@tool dartpad --template=stateful_widget_restoration_no_null_safety} /// {@tool dartpad --template=stateful_widget_restoration}
/// A [StatefulWidget] that has a restorable [int] property. /// A [StatefulWidget] that has a restorable [int] property.
/// ///
/// ```dart /// ```dart
...@@ -33,7 +30,7 @@ import 'restoration.dart'; ...@@ -33,7 +30,7 @@ import 'restoration.dart';
/// RestorableInt _answer = RestorableInt(42); /// RestorableInt _answer = RestorableInt(42);
/// ///
/// @override /// @override
/// void restoreState(RestorationBucket oldBucket, bool initialRestore) { /// void restoreState(RestorationBucket? oldBucket, bool initialRestore) {
/// // All restorable properties must be registered with the mixin. After /// // All restorable properties must be registered with the mixin. After
/// // registration, the answer either has its old value restored or is /// // registration, the answer either has its old value restored or is
/// // initialized to its default value. /// // initialized to its default value.
...@@ -77,14 +74,17 @@ import 'restoration.dart'; ...@@ -77,14 +74,17 @@ import 'restoration.dart';
/// Duration createDefaultValue() => const Duration(); /// Duration createDefaultValue() => const Duration();
/// ///
/// @override /// @override
/// void didUpdateValue(Duration oldValue) { /// void didUpdateValue(Duration? oldValue) {
/// if (oldValue.inMicroseconds != value.inMicroseconds) /// if (oldValue == null || oldValue.inMicroseconds != value.inMicroseconds)
/// notifyListeners(); /// notifyListeners();
/// } /// }
/// ///
/// @override /// @override
/// Duration fromPrimitives(Object data) { /// Duration fromPrimitives(Object? data) {
/// return Duration(microseconds: data as int); /// if (data != null) {
/// return Duration(microseconds: data as int);
/// }
/// return const Duration();
/// } /// }
/// ///
/// @override /// @override
......
...@@ -24,9 +24,8 @@ import 'scroll_controller.dart'; ...@@ -24,9 +24,8 @@ import 'scroll_controller.dart';
import 'transitions.dart'; import 'transitions.dart';
// Examples can assume: // Examples can assume:
// // @dart = 2.9
// dynamic routeObserver; // dynamic routeObserver;
// NavigatorState navigator; // late NavigatorState navigator;
/// A route that displays widgets in the [Navigator]'s [Overlay]. /// A route that displays widgets in the [Navigator]'s [Overlay].
abstract class OverlayRoute<T> extends Route<T> { abstract class OverlayRoute<T> extends Route<T> {
...@@ -541,7 +540,7 @@ mixin LocalHistoryRoute<T> on Route<T> { ...@@ -541,7 +540,7 @@ mixin LocalHistoryRoute<T> on Route<T> {
/// // rectangle. When this local history entry is removed, we hide the red /// // rectangle. When this local history entry is removed, we hide the red
/// // rectangle. /// // rectangle.
/// setState(() => _showRectangle = true); /// setState(() => _showRectangle = true);
/// ModalRoute.of(context).addLocalHistoryEntry( /// ModalRoute.of(context)?.addLocalHistoryEntry(
/// LocalHistoryEntry( /// LocalHistoryEntry(
/// onRemove: () { /// onRemove: () {
/// // Hide the red rectangle. /// // Hide the red rectangle.
......
...@@ -13,8 +13,7 @@ import 'inherited_theme.dart'; ...@@ -13,8 +13,7 @@ import 'inherited_theme.dart';
import 'media_query.dart'; import 'media_query.dart';
// Examples can assume: // Examples can assume:
// // @dart = 2.9 // late String _name;
// String _name;
/// The text style to apply to descendant [Text] widgets which don't have an /// The text style to apply to descendant [Text] widgets which don't have an
/// explicit style. /// explicit style.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment