Migrate some sample code (#72558)
diff --git a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart
index 0e380a7..9106bfd 100644
--- a/packages/flutter/lib/src/painting/continuous_rectangle_border.dart
+++ b/packages/flutter/lib/src/painting/continuous_rectangle_border.dart
@@ -93,7 +93,7 @@
final double top = rrect.top;
final double bottom = rrect.bottom;
// Radii will be clamped to the value of the shortest side
- /// of [rrect] to avoid strange tie-fighter shapes.
+ // of rrect to avoid strange tie-fighter shapes.
final double tlRadiusX =
math.max(0.0, _clampToShortest(rrect, rrect.tlRadiusX));
final double tlRadiusY =
diff --git a/packages/flutter/lib/src/painting/gradient.dart b/packages/flutter/lib/src/painting/gradient.dart
index 8943fd5..9ae124e 100644
--- a/packages/flutter/lib/src/painting/gradient.dart
+++ b/packages/flutter/lib/src/painting/gradient.dart
@@ -330,7 +330,7 @@
/// Typically this class is used with [BoxDecoration], which does the painting.
/// To use a [LinearGradient] to paint on a canvas directly, see [createShader].
///
-/// {@tool dartpad --template=stateless_widget_material_no_null_safety}
+/// {@tool dartpad --template=stateless_widget_material}
/// This sample draws a picture that looks like vertical window shades by having
/// a [Container] display a [BoxDecoration] with a [LinearGradient].
///
diff --git a/packages/flutter/lib/src/painting/image_stream.dart b/packages/flutter/lib/src/painting/image_stream.dart
index cc00675..4ab53f9 100644
--- a/packages/flutter/lib/src/painting/image_stream.dart
+++ b/packages/flutter/lib/src/painting/image_stream.dart
@@ -9,9 +9,6 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/scheduler.dart';
-// Examples can assume:
-// // @dart = 2.9
-
/// A [dart:ui.Image] object with its corresponding scale.
///
/// ImageInfo objects are used by [ImageStream] objects to represent the
@@ -69,8 +66,8 @@
/// [ImageInfo] reference refers to new image data or not.
///
/// ```dart
- /// ImageInfo _imageInfo;
- /// set imageInfo (ImageInfo value) {
+ /// ImageInfo? _imageInfo;
+ /// set imageInfo (ImageInfo? value) {
/// // If the image reference is exactly the same, do nothing.
/// if (value == _imageInfo) {
/// return;
@@ -78,7 +75,7 @@
/// // If it is a clone of the current reference, we must dispose of it and
/// // can do so immediately. Since the underlying image has not changed,
/// // We don't have any additional work to do here.
- /// if (value != null && _imageInfo != null && value.isCloneOf(_imageInfo)) {
+ /// if (value != null && _imageInfo != null && value.isCloneOf(_imageInfo!)) {
/// value.dispose();
/// return;
/// }
diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart
index 9a5581a..9415c5d 100644
--- a/packages/flutter/lib/src/painting/text_span.dart
+++ b/packages/flutter/lib/src/painting/text_span.dart
@@ -13,9 +13,6 @@
import 'text_painter.dart';
import 'text_style.dart';
-// Examples can assume:
-// // @dart = 2.9
-
/// An immutable span of text.
///
/// A [TextSpan] object can be styled using its [style] property. The style will
@@ -128,7 +125,7 @@
/// }
///
/// class _BuzzingTextState extends State<BuzzingText> {
- /// LongPressGestureRecognizer _longPressRecognizer;
+ /// late LongPressGestureRecognizer _longPressRecognizer;
///
/// @override
/// void initState() {
diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart
index c5524f7..8f3342d 100644
--- a/packages/flutter/lib/src/painting/text_style.dart
+++ b/packages/flutter/lib/src/painting/text_style.dart
@@ -25,8 +25,7 @@
const double _kDefaultFontSize = 14.0;
// Examples can assume:
-// // @dart = 2.9
-// BuildContext context;
+// late BuildContext context;
/// An immutable style describing how to format and paint text.
///
@@ -205,7 +204,7 @@
/// foreground: Paint()
/// ..style = PaintingStyle.stroke
/// ..strokeWidth = 6
-/// ..color = Colors.blue[700],
+/// ..color = Colors.blue[700]!,
/// ),
/// ),
/// // Solid text as fill.