Unverified Commit 5d74b5cb authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Remove unnecessary null checks in flutter/painting (#118925)

parent c757df3b
...@@ -19,9 +19,7 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm ...@@ -19,9 +19,7 @@ class NetworkImage extends image_provider.ImageProvider<image_provider.NetworkIm
/// Creates an object that fetches the image at the given URL. /// Creates an object that fetches the image at the given URL.
/// ///
/// The arguments [url] and [scale] must not be null. /// The arguments [url] and [scale] must not be null.
const NetworkImage(this.url, { this.scale = 1.0, this.headers }) const NetworkImage(this.url, { this.scale = 1.0, this.headers });
: assert(url != null),
assert(scale != null);
@override @override
final String url; final String url;
......
...@@ -39,9 +39,7 @@ class NetworkImage ...@@ -39,9 +39,7 @@ class NetworkImage
/// Creates an object that fetches the image at the given URL. /// Creates an object that fetches the image at the given URL.
/// ///
/// The arguments [url] and [scale] must not be null. /// The arguments [url] and [scale] must not be null.
const NetworkImage(this.url, {this.scale = 1.0, this.headers}) const NetworkImage(this.url, {this.scale = 1.0, this.headers});
: assert(url != null),
assert(scale != null);
@override @override
final String url; final String url;
......
...@@ -87,7 +87,6 @@ abstract class AlignmentGeometry { ...@@ -87,7 +87,6 @@ abstract class AlignmentGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static AlignmentGeometry? lerp(AlignmentGeometry? a, AlignmentGeometry? b, double t) { static AlignmentGeometry? lerp(AlignmentGeometry? a, AlignmentGeometry? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -188,9 +187,7 @@ class Alignment extends AlignmentGeometry { ...@@ -188,9 +187,7 @@ class Alignment extends AlignmentGeometry {
/// Creates an alignment. /// Creates an alignment.
/// ///
/// The [x] and [y] arguments must not be null. /// The [x] and [y] arguments must not be null.
const Alignment(this.x, this.y) const Alignment(this.x, this.y);
: assert(x != null),
assert(y != null);
/// The distance fraction in the horizontal direction. /// The distance fraction in the horizontal direction.
/// ///
...@@ -340,7 +337,6 @@ class Alignment extends AlignmentGeometry { ...@@ -340,7 +337,6 @@ class Alignment extends AlignmentGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static Alignment? lerp(Alignment? a, Alignment? b, double t) { static Alignment? lerp(Alignment? a, Alignment? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -407,9 +403,7 @@ class AlignmentDirectional extends AlignmentGeometry { ...@@ -407,9 +403,7 @@ class AlignmentDirectional extends AlignmentGeometry {
/// Creates a directional alignment. /// Creates a directional alignment.
/// ///
/// The [start] and [y] arguments must not be null. /// The [start] and [y] arguments must not be null.
const AlignmentDirectional(this.start, this.y) const AlignmentDirectional(this.start, this.y);
: assert(start != null),
assert(y != null);
/// The distance fraction in the horizontal direction. /// The distance fraction in the horizontal direction.
/// ///
...@@ -534,7 +528,6 @@ class AlignmentDirectional extends AlignmentGeometry { ...@@ -534,7 +528,6 @@ class AlignmentDirectional extends AlignmentGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static AlignmentDirectional? lerp(AlignmentDirectional? a, AlignmentDirectional? b, double t) { static AlignmentDirectional? lerp(AlignmentDirectional? a, AlignmentDirectional? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -682,8 +675,7 @@ class TextAlignVertical { ...@@ -682,8 +675,7 @@ class TextAlignVertical {
/// Creates a TextAlignVertical from any y value between -1.0 and 1.0. /// Creates a TextAlignVertical from any y value between -1.0 and 1.0.
const TextAlignVertical({ const TextAlignVertical({
required this.y, required this.y,
}) : assert(y != null), }) : assert(y >= -1.0 && y <= 1.0);
assert(y >= -1.0 && y <= 1.0);
/// A value ranging from -1.0 to 1.0 that defines the topmost and bottommost /// A value ranging from -1.0 to 1.0 that defines the topmost and bottommost
/// locations of the top and bottom of the input box. /// locations of the top and bottom of the input box.
......
...@@ -136,7 +136,6 @@ enum Axis { ...@@ -136,7 +136,6 @@ enum Axis {
/// ///
/// * [flipAxisDirection], which does the same thing for [AxisDirection] values. /// * [flipAxisDirection], which does the same thing for [AxisDirection] values.
Axis flipAxis(Axis direction) { Axis flipAxis(Axis direction) {
assert(direction != null);
switch (direction) { switch (direction) {
case Axis.horizontal: case Axis.horizontal:
return Axis.vertical; return Axis.vertical;
...@@ -204,7 +203,6 @@ enum AxisDirection { ...@@ -204,7 +203,6 @@ enum AxisDirection {
/// [AxisDirection.down] and returns [Axis.horizontal] for [AxisDirection.left] /// [AxisDirection.down] and returns [Axis.horizontal] for [AxisDirection.left]
/// and [AxisDirection.right]. /// and [AxisDirection.right].
Axis axisDirectionToAxis(AxisDirection axisDirection) { Axis axisDirectionToAxis(AxisDirection axisDirection) {
assert(axisDirection != null);
switch (axisDirection) { switch (axisDirection) {
case AxisDirection.up: case AxisDirection.up:
case AxisDirection.down: case AxisDirection.down:
...@@ -220,7 +218,6 @@ Axis axisDirectionToAxis(AxisDirection axisDirection) { ...@@ -220,7 +218,6 @@ Axis axisDirectionToAxis(AxisDirection axisDirection) {
/// Specifically, returns [AxisDirection.left] for [TextDirection.rtl] and /// Specifically, returns [AxisDirection.left] for [TextDirection.rtl] and
/// [AxisDirection.right] for [TextDirection.ltr]. /// [AxisDirection.right] for [TextDirection.ltr].
AxisDirection textDirectionToAxisDirection(TextDirection textDirection) { AxisDirection textDirectionToAxisDirection(TextDirection textDirection) {
assert(textDirection != null);
switch (textDirection) { switch (textDirection) {
case TextDirection.rtl: case TextDirection.rtl:
return AxisDirection.left; return AxisDirection.left;
...@@ -239,7 +236,6 @@ AxisDirection textDirectionToAxisDirection(TextDirection textDirection) { ...@@ -239,7 +236,6 @@ AxisDirection textDirectionToAxisDirection(TextDirection textDirection) {
/// ///
/// * [flipAxis], which does the same thing for [Axis] values. /// * [flipAxis], which does the same thing for [Axis] values.
AxisDirection flipAxisDirection(AxisDirection axisDirection) { AxisDirection flipAxisDirection(AxisDirection axisDirection) {
assert(axisDirection != null);
switch (axisDirection) { switch (axisDirection) {
case AxisDirection.up: case AxisDirection.up:
return AxisDirection.down; return AxisDirection.down;
...@@ -258,7 +254,6 @@ AxisDirection flipAxisDirection(AxisDirection axisDirection) { ...@@ -258,7 +254,6 @@ AxisDirection flipAxisDirection(AxisDirection axisDirection) {
/// Specifically, returns true for [AxisDirection.up] and [AxisDirection.left] /// Specifically, returns true for [AxisDirection.up] and [AxisDirection.left]
/// and false for [AxisDirection.down] and [AxisDirection.right]. /// and false for [AxisDirection.down] and [AxisDirection.right].
bool axisDirectionIsReversed(AxisDirection axisDirection) { bool axisDirectionIsReversed(AxisDirection axisDirection) {
assert(axisDirection != null);
switch (axisDirection) { switch (axisDirection) {
case AxisDirection.up: case AxisDirection.up:
case AxisDirection.left: case AxisDirection.left:
......
...@@ -25,8 +25,7 @@ class BeveledRectangleBorder extends OutlinedBorder { ...@@ -25,8 +25,7 @@ class BeveledRectangleBorder extends OutlinedBorder {
const BeveledRectangleBorder({ const BeveledRectangleBorder({
super.side, super.side,
this.borderRadius = BorderRadius.zero, this.borderRadius = BorderRadius.zero,
}) : assert(side != null), });
assert(borderRadius != null);
/// The radii for each corner. /// The radii for each corner.
/// ///
...@@ -49,7 +48,6 @@ class BeveledRectangleBorder extends OutlinedBorder { ...@@ -49,7 +48,6 @@ class BeveledRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is BeveledRectangleBorder) { if (a is BeveledRectangleBorder) {
return BeveledRectangleBorder( return BeveledRectangleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
...@@ -61,7 +59,6 @@ class BeveledRectangleBorder extends OutlinedBorder { ...@@ -61,7 +59,6 @@ class BeveledRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is BeveledRectangleBorder) { if (b is BeveledRectangleBorder) {
return BeveledRectangleBorder( return BeveledRectangleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
......
...@@ -111,7 +111,6 @@ mixin PaintingBinding on BindingBase, ServicesBinding { ...@@ -111,7 +111,6 @@ mixin PaintingBinding on BindingBase, ServicesBinding {
}) { }) {
assert(cacheWidth == null || cacheWidth > 0); assert(cacheWidth == null || cacheWidth > 0);
assert(cacheHeight == null || cacheHeight > 0); assert(cacheHeight == null || cacheHeight > 0);
assert(allowUpscaling != null);
return ui.instantiateImageCodec( return ui.instantiateImageCodec(
bytes, bytes,
targetWidth: cacheWidth, targetWidth: cacheWidth,
...@@ -149,7 +148,6 @@ mixin PaintingBinding on BindingBase, ServicesBinding { ...@@ -149,7 +148,6 @@ mixin PaintingBinding on BindingBase, ServicesBinding {
}) { }) {
assert(cacheWidth == null || cacheWidth > 0); assert(cacheWidth == null || cacheWidth > 0);
assert(cacheHeight == null || cacheHeight > 0); assert(cacheHeight == null || cacheHeight > 0);
assert(allowUpscaling != null);
return ui.instantiateImageCodecFromBuffer( return ui.instantiateImageCodecFromBuffer(
buffer, buffer,
targetWidth: cacheWidth, targetWidth: cacheWidth,
......
...@@ -129,7 +129,6 @@ abstract class BorderRadiusGeometry { ...@@ -129,7 +129,6 @@ abstract class BorderRadiusGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BorderRadiusGeometry? lerp(BorderRadiusGeometry? a, BorderRadiusGeometry? b, double t) { static BorderRadiusGeometry? lerp(BorderRadiusGeometry? a, BorderRadiusGeometry? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -507,7 +506,6 @@ class BorderRadius extends BorderRadiusGeometry { ...@@ -507,7 +506,6 @@ class BorderRadius extends BorderRadiusGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BorderRadius? lerp(BorderRadius? a, BorderRadius? b, double t) { static BorderRadius? lerp(BorderRadius? a, BorderRadius? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -729,7 +727,6 @@ class BorderRadiusDirectional extends BorderRadiusGeometry { ...@@ -729,7 +727,6 @@ class BorderRadiusDirectional extends BorderRadiusGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BorderRadiusDirectional? lerp(BorderRadiusDirectional? a, BorderRadiusDirectional? b, double t) { static BorderRadiusDirectional? lerp(BorderRadiusDirectional? a, BorderRadiusDirectional? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -66,11 +66,7 @@ class BorderSide with Diagnosticable { ...@@ -66,11 +66,7 @@ class BorderSide with Diagnosticable {
this.width = 1.0, this.width = 1.0,
this.style = BorderStyle.solid, this.style = BorderStyle.solid,
this.strokeAlign = strokeAlignInside, this.strokeAlign = strokeAlignInside,
}) : assert(color != null), }) : assert(width >= 0.0);
assert(width != null),
assert(width >= 0.0),
assert(style != null),
assert(strokeAlign != null);
/// Creates a [BorderSide] that represents the addition of the two given /// Creates a [BorderSide] that represents the addition of the two given
/// [BorderSide]s. /// [BorderSide]s.
...@@ -84,8 +80,6 @@ class BorderSide with Diagnosticable { ...@@ -84,8 +80,6 @@ class BorderSide with Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
static BorderSide merge(BorderSide a, BorderSide b) { static BorderSide merge(BorderSide a, BorderSide b) {
assert(a != null);
assert(b != null);
assert(canMerge(a, b)); assert(canMerge(a, b));
final bool aIsNone = a.style == BorderStyle.none && a.width == 0.0; final bool aIsNone = a.style == BorderStyle.none && a.width == 0.0;
final bool bIsNone = b.style == BorderStyle.none && b.width == 0.0; final bool bIsNone = b.style == BorderStyle.none && b.width == 0.0;
...@@ -202,7 +196,6 @@ class BorderSide with Diagnosticable { ...@@ -202,7 +196,6 @@ class BorderSide with Diagnosticable {
/// Values for `t` are usually obtained from an [Animation<double>], such as /// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController]. /// an [AnimationController].
BorderSide scale(double t) { BorderSide scale(double t) {
assert(t != null);
return BorderSide( return BorderSide(
color: color, color: color,
width: math.max(0.0, width * t), width: math.max(0.0, width * t),
...@@ -239,8 +232,6 @@ class BorderSide with Diagnosticable { ...@@ -239,8 +232,6 @@ class BorderSide with Diagnosticable {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
static bool canMerge(BorderSide a, BorderSide b) { static bool canMerge(BorderSide a, BorderSide b) {
assert(a != null);
assert(b != null);
if ((a.style == BorderStyle.none && a.width == 0.0) || if ((a.style == BorderStyle.none && a.width == 0.0) ||
(b.style == BorderStyle.none && b.width == 0.0)) { (b.style == BorderStyle.none && b.width == 0.0)) {
return true; return true;
...@@ -255,9 +246,6 @@ class BorderSide with Diagnosticable { ...@@ -255,9 +246,6 @@ class BorderSide with Diagnosticable {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BorderSide lerp(BorderSide a, BorderSide b, double t) { static BorderSide lerp(BorderSide a, BorderSide b, double t) {
assert(a != null);
assert(b != null);
assert(t != null);
if (t == 0.0) { if (t == 0.0) {
return a; return a;
} }
...@@ -517,7 +505,6 @@ abstract class ShapeBorder { ...@@ -517,7 +505,6 @@ abstract class ShapeBorder {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static ShapeBorder? lerp(ShapeBorder? a, ShapeBorder? b, double t) { static ShapeBorder? lerp(ShapeBorder? a, ShapeBorder? b, double t) {
assert(t != null);
ShapeBorder? result; ShapeBorder? result;
if (b != null) { if (b != null) {
result = b.lerpFrom(a, t); result = b.lerpFrom(a, t);
...@@ -664,7 +651,7 @@ abstract class OutlinedBorder extends ShapeBorder { ...@@ -664,7 +651,7 @@ abstract class OutlinedBorder extends ShapeBorder {
/// const constructors so that they can be used in const expressions. /// const constructors so that they can be used in const expressions.
/// ///
/// The value of [side] must not be null. /// The value of [side] must not be null.
const OutlinedBorder({ this.side = BorderSide.none }) : assert(side != null); const OutlinedBorder({ this.side = BorderSide.none });
@override @override
EdgeInsetsGeometry get dimensions => EdgeInsets.all(math.max(side.strokeInset, 0)); EdgeInsetsGeometry get dimensions => EdgeInsets.all(math.max(side.strokeInset, 0));
...@@ -707,7 +694,6 @@ abstract class OutlinedBorder extends ShapeBorder { ...@@ -707,7 +694,6 @@ abstract class OutlinedBorder extends ShapeBorder {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static OutlinedBorder? lerp(OutlinedBorder? a, OutlinedBorder? b, double t) { static OutlinedBorder? lerp(OutlinedBorder? a, OutlinedBorder? b, double t) {
assert(t != null);
ShapeBorder? result; ShapeBorder? result;
if (b != null) { if (b != null) {
result = b.lerpFrom(a, t); result = b.lerpFrom(a, t);
...@@ -724,8 +710,7 @@ abstract class OutlinedBorder extends ShapeBorder { ...@@ -724,8 +710,7 @@ abstract class OutlinedBorder extends ShapeBorder {
/// The borders are listed from the outside to the inside. /// The borders are listed from the outside to the inside.
class _CompoundBorder extends ShapeBorder { class _CompoundBorder extends ShapeBorder {
_CompoundBorder(this.borders) _CompoundBorder(this.borders)
: assert(borders != null), : assert(borders.length >= 2),
assert(borders.length >= 2),
assert(!borders.any((ShapeBorder border) => border is _CompoundBorder)); assert(!borders.any((ShapeBorder border) => border is _CompoundBorder));
final List<ShapeBorder> borders; final List<ShapeBorder> borders;
...@@ -788,7 +773,6 @@ class _CompoundBorder extends ShapeBorder { ...@@ -788,7 +773,6 @@ class _CompoundBorder extends ShapeBorder {
} }
static _CompoundBorder lerp(ShapeBorder? a, ShapeBorder? b, double t) { static _CompoundBorder lerp(ShapeBorder? a, ShapeBorder? b, double t) {
assert(t != null);
assert(a is _CompoundBorder || b is _CompoundBorder); // Not really necessary, but all call sites currently intend this. assert(a is _CompoundBorder || b is _CompoundBorder); // Not really necessary, but all call sites currently intend this.
final List<ShapeBorder?> aList = a is _CompoundBorder ? a.borders : <ShapeBorder?>[a]; final List<ShapeBorder?> aList = a is _CompoundBorder ? a.borders : <ShapeBorder?>[a];
final List<ShapeBorder?> bList = b is _CompoundBorder ? b.borders : <ShapeBorder?>[b]; final List<ShapeBorder?> bList = b is _CompoundBorder ? b.borders : <ShapeBorder?>[b];
...@@ -897,12 +881,6 @@ void paintBorder( ...@@ -897,12 +881,6 @@ void paintBorder(
BorderSide bottom = BorderSide.none, BorderSide bottom = BorderSide.none,
BorderSide left = BorderSide.none, BorderSide left = BorderSide.none,
}) { }) {
assert(canvas != null);
assert(rect != null);
assert(top != null);
assert(right != null);
assert(bottom != null);
assert(left != null);
// We draw the borders as filled shapes, unless the borders are hairline // We draw the borders as filled shapes, unless the borders are hairline
// borders, in which case we use PaintingStyle.stroke, with the stroke width // borders, in which case we use PaintingStyle.stroke, with the stroke width
......
...@@ -103,7 +103,6 @@ abstract class BoxBorder extends ShapeBorder { ...@@ -103,7 +103,6 @@ abstract class BoxBorder extends ShapeBorder {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BoxBorder? lerp(BoxBorder? a, BoxBorder? b, double t) { static BoxBorder? lerp(BoxBorder? a, BoxBorder? b, double t) {
assert(t != null);
if ((a is Border?) && (b is Border?)) { if ((a is Border?) && (b is Border?)) {
return Border.lerp(a, b, t); return Border.lerp(a, b, t);
} }
...@@ -322,17 +321,13 @@ class Border extends BoxBorder { ...@@ -322,17 +321,13 @@ class Border extends BoxBorder {
this.right = BorderSide.none, this.right = BorderSide.none,
this.bottom = BorderSide.none, this.bottom = BorderSide.none,
this.left = BorderSide.none, this.left = BorderSide.none,
}) : assert(top != null), });
assert(right != null),
assert(bottom != null),
assert(left != null);
/// Creates a border whose sides are all the same. /// Creates a border whose sides are all the same.
/// ///
/// The `side` argument must not be null. /// The `side` argument must not be null.
const Border.fromBorderSide(BorderSide side) const Border.fromBorderSide(BorderSide side)
: assert(side != null), : top = side,
top = side,
right = side, right = side,
bottom = side, bottom = side,
left = side; left = side;
...@@ -346,9 +341,7 @@ class Border extends BoxBorder { ...@@ -346,9 +341,7 @@ class Border extends BoxBorder {
const Border.symmetric({ const Border.symmetric({
BorderSide vertical = BorderSide.none, BorderSide vertical = BorderSide.none,
BorderSide horizontal = BorderSide.none, BorderSide horizontal = BorderSide.none,
}) : assert(vertical != null), }) : left = vertical,
assert(horizontal != null),
left = vertical,
top = horizontal, top = horizontal,
right = vertical, right = vertical,
bottom = horizontal; bottom = horizontal;
...@@ -374,8 +367,6 @@ class Border extends BoxBorder { ...@@ -374,8 +367,6 @@ class Border extends BoxBorder {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
static Border merge(Border a, Border b) { static Border merge(Border a, Border b) {
assert(a != null);
assert(b != null);
assert(BorderSide.canMerge(a.top, b.top)); assert(BorderSide.canMerge(a.top, b.top));
assert(BorderSide.canMerge(a.right, b.right)); assert(BorderSide.canMerge(a.right, b.right));
assert(BorderSide.canMerge(a.bottom, b.bottom)); assert(BorderSide.canMerge(a.bottom, b.bottom));
...@@ -478,7 +469,6 @@ class Border extends BoxBorder { ...@@ -478,7 +469,6 @@ class Border extends BoxBorder {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static Border? lerp(Border? a, Border? b, double t) { static Border? lerp(Border? a, Border? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -650,10 +640,7 @@ class BorderDirectional extends BoxBorder { ...@@ -650,10 +640,7 @@ class BorderDirectional extends BoxBorder {
this.start = BorderSide.none, this.start = BorderSide.none,
this.end = BorderSide.none, this.end = BorderSide.none,
this.bottom = BorderSide.none, this.bottom = BorderSide.none,
}) : assert(top != null), });
assert(start != null),
assert(end != null),
assert(bottom != null);
/// Creates a [BorderDirectional] that represents the addition of the two /// Creates a [BorderDirectional] that represents the addition of the two
/// given [BorderDirectional]s. /// given [BorderDirectional]s.
...@@ -663,8 +650,6 @@ class BorderDirectional extends BoxBorder { ...@@ -663,8 +650,6 @@ class BorderDirectional extends BoxBorder {
/// ///
/// The arguments must not be null. /// The arguments must not be null.
static BorderDirectional merge(BorderDirectional a, BorderDirectional b) { static BorderDirectional merge(BorderDirectional a, BorderDirectional b) {
assert(a != null);
assert(b != null);
assert(BorderSide.canMerge(a.top, b.top)); assert(BorderSide.canMerge(a.top, b.top));
assert(BorderSide.canMerge(a.start, b.start)); assert(BorderSide.canMerge(a.start, b.start));
assert(BorderSide.canMerge(a.end, b.end)); assert(BorderSide.canMerge(a.end, b.end));
...@@ -826,7 +811,6 @@ class BorderDirectional extends BoxBorder { ...@@ -826,7 +811,6 @@ class BorderDirectional extends BoxBorder {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BorderDirectional? lerp(BorderDirectional? a, BorderDirectional? b, double t) { static BorderDirectional? lerp(BorderDirectional? a, BorderDirectional? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -93,8 +93,7 @@ class BoxDecoration extends Decoration { ...@@ -93,8 +93,7 @@ class BoxDecoration extends Decoration {
this.gradient, this.gradient,
this.backgroundBlendMode, this.backgroundBlendMode,
this.shape = BoxShape.rectangle, this.shape = BoxShape.rectangle,
}) : assert(shape != null), }) : assert(
assert(
backgroundBlendMode == null || color != null || gradient != null, backgroundBlendMode == null || color != null || gradient != null,
"backgroundBlendMode applies to BoxDecoration's background color or " "backgroundBlendMode applies to BoxDecoration's background color or "
'gradient, but no color or gradient was provided.', 'gradient, but no color or gradient was provided.',
...@@ -289,7 +288,6 @@ class BoxDecoration extends Decoration { ...@@ -289,7 +288,6 @@ class BoxDecoration extends Decoration {
/// and which use [BoxDecoration.lerp] when interpolating two /// and which use [BoxDecoration.lerp] when interpolating two
/// [BoxDecoration]s or a [BoxDecoration] to or from null. /// [BoxDecoration]s or a [BoxDecoration] to or from null.
static BoxDecoration? lerp(BoxDecoration? a, BoxDecoration? b, double t) { static BoxDecoration? lerp(BoxDecoration? a, BoxDecoration? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -365,7 +363,6 @@ class BoxDecoration extends Decoration { ...@@ -365,7 +363,6 @@ class BoxDecoration extends Decoration {
@override @override
bool hitTest(Size size, Offset position, { TextDirection? textDirection }) { bool hitTest(Size size, Offset position, { TextDirection? textDirection }) {
assert(shape != null);
assert((Offset.zero & size).contains(position)); assert((Offset.zero & size).contains(position));
switch (shape) { switch (shape) {
case BoxShape.rectangle: case BoxShape.rectangle:
...@@ -391,15 +388,13 @@ class BoxDecoration extends Decoration { ...@@ -391,15 +388,13 @@ class BoxDecoration extends Decoration {
/// An object that paints a [BoxDecoration] into a canvas. /// An object that paints a [BoxDecoration] into a canvas.
class _BoxDecorationPainter extends BoxPainter { class _BoxDecorationPainter extends BoxPainter {
_BoxDecorationPainter(this._decoration, super.onChanged) _BoxDecorationPainter(this._decoration, super.onChanged);
: assert(_decoration != null);
final BoxDecoration _decoration; final BoxDecoration _decoration;
Paint? _cachedBackgroundPaint; Paint? _cachedBackgroundPaint;
Rect? _rectForCachedBackgroundPaint; Rect? _rectForCachedBackgroundPaint;
Paint _getBackgroundPaint(Rect rect, TextDirection? textDirection) { Paint _getBackgroundPaint(Rect rect, TextDirection? textDirection) {
assert(rect != null);
assert(_decoration.gradient != null || _rectForCachedBackgroundPaint == null); assert(_decoration.gradient != null || _rectForCachedBackgroundPaint == null);
if (_cachedBackgroundPaint == null || if (_cachedBackgroundPaint == null ||
...@@ -489,7 +484,6 @@ class _BoxDecorationPainter extends BoxPainter { ...@@ -489,7 +484,6 @@ class _BoxDecorationPainter extends BoxPainter {
/// Paint the box decoration into the given location on the given canvas. /// Paint the box decoration into the given location on the given canvas.
@override @override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
assert(configuration != null);
assert(configuration.size != null); assert(configuration.size != null);
final Rect rect = offset & configuration.size!; final Rect rect = offset & configuration.size!;
final TextDirection? textDirection = configuration.textDirection; final TextDirection? textDirection = configuration.textDirection;
......
...@@ -86,7 +86,6 @@ class BoxShadow extends ui.Shadow { ...@@ -86,7 +86,6 @@ class BoxShadow extends ui.Shadow {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static BoxShadow? lerp(BoxShadow? a, BoxShadow? b, double t) { static BoxShadow? lerp(BoxShadow? a, BoxShadow? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -111,7 +110,6 @@ class BoxShadow extends ui.Shadow { ...@@ -111,7 +110,6 @@ class BoxShadow extends ui.Shadow {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static List<BoxShadow>? lerpList(List<BoxShadow>? a, List<BoxShadow>? b, double t) { static List<BoxShadow>? lerpList(List<BoxShadow>? a, List<BoxShadow>? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -33,9 +33,7 @@ class CircleBorder extends OutlinedBorder { ...@@ -33,9 +33,7 @@ class CircleBorder extends OutlinedBorder {
/// ///
/// The [side] argument must not be null. /// The [side] argument must not be null.
const CircleBorder({ super.side, this.eccentricity = 0.0 }) const CircleBorder({ super.side, this.eccentricity = 0.0 })
: assert(side != null), : assert(eccentricity >= 0.0, 'The eccentricity argument $eccentricity is not greater than or equal to zero.'),
assert(eccentricity != null),
assert(eccentricity >= 0.0, 'The eccentricity argument $eccentricity is not greater than or equal to zero.'),
assert(eccentricity <= 1.0, 'The eccentricity argument $eccentricity is not less than or equal to one.'); assert(eccentricity <= 1.0, 'The eccentricity argument $eccentricity is not less than or equal to one.');
/// Defines the ratio (0.0-1.0) from which the border will deform /// Defines the ratio (0.0-1.0) from which the border will deform
......
...@@ -10,7 +10,6 @@ abstract class ClipContext { ...@@ -10,7 +10,6 @@ abstract class ClipContext {
Canvas get canvas; Canvas get canvas;
void _clipAndPaint(void Function(bool doAntiAlias) canvasClipCall, Clip clipBehavior, Rect bounds, VoidCallback painter) { void _clipAndPaint(void Function(bool doAntiAlias) canvasClipCall, Clip clipBehavior, Rect bounds, VoidCallback painter) {
assert(canvasClipCall != null);
canvas.save(); canvas.save();
switch (clipBehavior) { switch (clipBehavior) {
case Clip.none: case Clip.none:
......
...@@ -89,11 +89,7 @@ class HSVColor { ...@@ -89,11 +89,7 @@ class HSVColor {
/// All the arguments must not be null and be in their respective ranges. See /// All the arguments must not be null and be in their respective ranges. See
/// the fields for each parameter for a description of their ranges. /// the fields for each parameter for a description of their ranges.
const HSVColor.fromAHSV(this.alpha, this.hue, this.saturation, this.value) const HSVColor.fromAHSV(this.alpha, this.hue, this.saturation, this.value)
: assert(alpha != null), : assert(alpha >= 0.0),
assert(hue != null),
assert(saturation != null),
assert(value != null),
assert(alpha >= 0.0),
assert(alpha <= 1.0), assert(alpha <= 1.0),
assert(hue >= 0.0), assert(hue >= 0.0),
assert(hue <= 360.0), assert(hue <= 360.0),
...@@ -198,7 +194,6 @@ class HSVColor { ...@@ -198,7 +194,6 @@ class HSVColor {
/// ///
/// Values outside of the valid range for each channel will be clamped. /// Values outside of the valid range for each channel will be clamped.
static HSVColor? lerp(HSVColor? a, HSVColor? b, double t) { static HSVColor? lerp(HSVColor? a, HSVColor? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -262,11 +257,7 @@ class HSLColor { ...@@ -262,11 +257,7 @@ class HSLColor {
/// All the arguments must not be null and be in their respective ranges. See /// All the arguments must not be null and be in their respective ranges. See
/// the fields for each parameter for a description of their ranges. /// the fields for each parameter for a description of their ranges.
const HSLColor.fromAHSL(this.alpha, this.hue, this.saturation, this.lightness) const HSLColor.fromAHSL(this.alpha, this.hue, this.saturation, this.lightness)
: assert(alpha != null), : assert(alpha >= 0.0),
assert(hue != null),
assert(saturation != null),
assert(lightness != null),
assert(alpha >= 0.0),
assert(alpha <= 1.0), assert(alpha <= 1.0),
assert(hue >= 0.0), assert(hue >= 0.0),
assert(hue <= 360.0), assert(hue <= 360.0),
...@@ -386,7 +377,6 @@ class HSLColor { ...@@ -386,7 +377,6 @@ class HSLColor {
/// Values for `t` are usually obtained from an [Animation<double>], such as /// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController]. /// an [AnimationController].
static HSLColor? lerp(HSLColor? a, HSLColor? b, double t) { static HSLColor? lerp(HSLColor? a, HSLColor? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -519,9 +509,7 @@ class ColorProperty extends DiagnosticsProperty<Color> { ...@@ -519,9 +509,7 @@ class ColorProperty extends DiagnosticsProperty<Color> {
super.defaultValue, super.defaultValue,
super.style, super.style,
super.level, super.level,
}) : assert(showName != null), });
assert(style != null),
assert(level != null);
@override @override
Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) { Map<String, Object?> toJsonMap(DiagnosticsSerializationDelegate delegate) {
......
...@@ -37,8 +37,7 @@ class ContinuousRectangleBorder extends OutlinedBorder { ...@@ -37,8 +37,7 @@ class ContinuousRectangleBorder extends OutlinedBorder {
const ContinuousRectangleBorder({ const ContinuousRectangleBorder({
super.side, super.side,
this.borderRadius = BorderRadius.zero, this.borderRadius = BorderRadius.zero,
}) : assert(side != null), });
assert(borderRadius != null);
/// The radius for each corner. /// The radius for each corner.
/// ///
...@@ -59,7 +58,6 @@ class ContinuousRectangleBorder extends OutlinedBorder { ...@@ -59,7 +58,6 @@ class ContinuousRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is ContinuousRectangleBorder) { if (a is ContinuousRectangleBorder) {
return ContinuousRectangleBorder( return ContinuousRectangleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
...@@ -71,7 +69,6 @@ class ContinuousRectangleBorder extends OutlinedBorder { ...@@ -71,7 +69,6 @@ class ContinuousRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is ContinuousRectangleBorder) { if (b is ContinuousRectangleBorder) {
return ContinuousRectangleBorder( return ContinuousRectangleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
......
...@@ -129,7 +129,6 @@ abstract class Decoration with Diagnosticable { ...@@ -129,7 +129,6 @@ abstract class Decoration with Diagnosticable {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static Decoration? lerp(Decoration? a, Decoration? b, double t) { static Decoration? lerp(Decoration? a, Decoration? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -57,11 +57,7 @@ class DecorationImage { ...@@ -57,11 +57,7 @@ class DecorationImage {
this.filterQuality = FilterQuality.low, this.filterQuality = FilterQuality.low,
this.invertColors = false, this.invertColors = false,
this.isAntiAlias = false, this.isAntiAlias = false,
}) : assert(image != null), });
assert(alignment != null),
assert(repeat != null),
assert(matchTextDirection != null),
assert(scale != null);
/// The image to be painted into the decoration. /// The image to be painted into the decoration.
/// ///
...@@ -181,7 +177,6 @@ class DecorationImage { ...@@ -181,7 +177,6 @@ class DecorationImage {
/// image needs to be repainted, e.g. because it is loading incrementally or /// image needs to be repainted, e.g. because it is loading incrementally or
/// because it is animated. /// because it is animated.
DecorationImagePainter createPainter(VoidCallback onChanged) { DecorationImagePainter createPainter(VoidCallback onChanged) {
assert(onChanged != null);
return DecorationImagePainter._(this, onChanged); return DecorationImagePainter._(this, onChanged);
} }
...@@ -265,7 +260,7 @@ class DecorationImage { ...@@ -265,7 +260,7 @@ class DecorationImage {
/// This object should be disposed using the [dispose] method when it is no /// This object should be disposed using the [dispose] method when it is no
/// longer needed. /// longer needed.
class DecorationImagePainter { class DecorationImagePainter {
DecorationImagePainter._(this._details, this._onChanged) : assert(_details != null); DecorationImagePainter._(this._details, this._onChanged);
final DecorationImage _details; final DecorationImage _details;
final VoidCallback _onChanged; final VoidCallback _onChanged;
...@@ -288,9 +283,6 @@ class DecorationImagePainter { ...@@ -288,9 +283,6 @@ class DecorationImagePainter {
/// then the `onChanged` callback passed to [DecorationImage.createPainter] /// then the `onChanged` callback passed to [DecorationImage.createPainter]
/// will be called. /// will be called.
void paint(Canvas canvas, Rect rect, Path? clipPath, ImageConfiguration configuration) { void paint(Canvas canvas, Rect rect, Path? clipPath, ImageConfiguration configuration) {
assert(canvas != null);
assert(rect != null);
assert(configuration != null);
bool flipHorizontally = false; bool flipHorizontally = false;
if (_details.matchTextDirection) { if (_details.matchTextDirection) {
...@@ -367,7 +359,6 @@ class DecorationImagePainter { ...@@ -367,7 +359,6 @@ class DecorationImagePainter {
} }
_image?.dispose(); _image?.dispose();
_image = value; _image = value;
assert(_onChanged != null);
if (!synchronousCall) { if (!synchronousCall) {
_onChanged(); _onChanged();
} }
...@@ -500,12 +491,6 @@ void paintImage({ ...@@ -500,12 +491,6 @@ void paintImage({
FilterQuality filterQuality = FilterQuality.low, FilterQuality filterQuality = FilterQuality.low,
bool isAntiAlias = false, bool isAntiAlias = false,
}) { }) {
assert(canvas != null);
assert(image != null);
assert(alignment != null);
assert(repeat != null);
assert(flipHorizontally != null);
assert(isAntiAlias != null);
assert( assert(
image.debugGetOpenHandleStackTraces()?.isNotEmpty ?? true, image.debugGetOpenHandleStackTraces()?.isNotEmpty ?? true,
'Cannot paint an image that is disposed.\n' 'Cannot paint an image that is disposed.\n'
......
...@@ -64,7 +64,6 @@ abstract class EdgeInsetsGeometry { ...@@ -64,7 +64,6 @@ abstract class EdgeInsetsGeometry {
/// The total offset in the given direction. /// The total offset in the given direction.
double along(Axis axis) { double along(Axis axis) {
assert(axis != null);
switch (axis) { switch (axis) {
case Axis.horizontal: case Axis.horizontal:
return horizontal; return horizontal;
...@@ -216,7 +215,6 @@ abstract class EdgeInsetsGeometry { ...@@ -216,7 +215,6 @@ abstract class EdgeInsetsGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static EdgeInsetsGeometry? lerp(EdgeInsetsGeometry? a, EdgeInsetsGeometry? b, double t) { static EdgeInsetsGeometry? lerp(EdgeInsetsGeometry? a, EdgeInsetsGeometry? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -604,7 +602,6 @@ class EdgeInsets extends EdgeInsetsGeometry { ...@@ -604,7 +602,6 @@ class EdgeInsets extends EdgeInsetsGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static EdgeInsets? lerp(EdgeInsets? a, EdgeInsets? b, double t) { static EdgeInsets? lerp(EdgeInsets? a, EdgeInsets? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -871,7 +868,6 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry { ...@@ -871,7 +868,6 @@ class EdgeInsetsDirectional extends EdgeInsetsGeometry {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static EdgeInsetsDirectional? lerp(EdgeInsetsDirectional? a, EdgeInsetsDirectional? b, double t) { static EdgeInsetsDirectional? lerp(EdgeInsetsDirectional? a, EdgeInsetsDirectional? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -44,10 +44,7 @@ class FlutterLogoDecoration extends Decoration { ...@@ -44,10 +44,7 @@ class FlutterLogoDecoration extends Decoration {
this.textColor = const Color(0xFF757575), this.textColor = const Color(0xFF757575),
this.style = FlutterLogoStyle.markOnly, this.style = FlutterLogoStyle.markOnly,
this.margin = EdgeInsets.zero, this.margin = EdgeInsets.zero,
}) : assert(textColor != null), }) : _position = identical(style, FlutterLogoStyle.markOnly) ? 0.0 : identical(style, FlutterLogoStyle.horizontal) ? 1.0 : -1.0,
assert(style != null),
assert(margin != null),
_position = identical(style, FlutterLogoStyle.markOnly) ? 0.0 : identical(style, FlutterLogoStyle.horizontal) ? 1.0 : -1.0,
_opacity = 1.0; _opacity = 1.0;
const FlutterLogoDecoration._(this.textColor, this.style, this.margin, this._position, this._opacity); const FlutterLogoDecoration._(this.textColor, this.style, this.margin, this._position, this._opacity);
...@@ -78,12 +75,7 @@ class FlutterLogoDecoration extends Decoration { ...@@ -78,12 +75,7 @@ class FlutterLogoDecoration extends Decoration {
@override @override
bool debugAssertIsValid() { bool debugAssertIsValid() {
assert( assert(
textColor != null _position.isFinite
&& style != null
&& margin != null
&& _position != null
&& _position.isFinite
&& _opacity != null
&& _opacity >= 0.0 && _opacity >= 0.0
&& _opacity <= 1.0, && _opacity <= 1.0,
); );
...@@ -107,7 +99,6 @@ class FlutterLogoDecoration extends Decoration { ...@@ -107,7 +99,6 @@ class FlutterLogoDecoration extends Decoration {
/// ///
/// * [Decoration.lerp], which interpolates between arbitrary decorations. /// * [Decoration.lerp], which interpolates between arbitrary decorations.
static FlutterLogoDecoration? lerp(FlutterLogoDecoration? a, FlutterLogoDecoration? b, double t) { static FlutterLogoDecoration? lerp(FlutterLogoDecoration? a, FlutterLogoDecoration? b, double t) {
assert(t != null);
assert(a == null || a.debugAssertIsValid()); assert(a == null || a.debugAssertIsValid());
assert(b == null || b.debugAssertIsValid()); assert(b == null || b.debugAssertIsValid());
if (a == null && b == null) { if (a == null && b == null) {
...@@ -218,8 +209,7 @@ class FlutterLogoDecoration extends Decoration { ...@@ -218,8 +209,7 @@ class FlutterLogoDecoration extends Decoration {
/// An object that paints a [BoxDecoration] into a canvas. /// An object that paints a [BoxDecoration] into a canvas.
class _FlutterLogoPainter extends BoxPainter { class _FlutterLogoPainter extends BoxPainter {
_FlutterLogoPainter(this._config) _FlutterLogoPainter(this._config)
: assert(_config != null), : assert(_config.debugAssertIsValid()),
assert(_config.debugAssertIsValid()),
super(null) { super(null) {
_prepareText(); _prepareText();
} }
......
...@@ -56,17 +56,13 @@ class FractionalOffset extends Alignment { ...@@ -56,17 +56,13 @@ class FractionalOffset extends Alignment {
/// ///
/// The [dx] and [dy] arguments must not be null. /// The [dx] and [dy] arguments must not be null.
const FractionalOffset(double dx, double dy) const FractionalOffset(double dx, double dy)
: assert(dx != null), : super(dx * 2.0 - 1.0, dy * 2.0 - 1.0);
assert(dy != null),
super(dx * 2.0 - 1.0, dy * 2.0 - 1.0);
/// Creates a fractional offset from a specific offset and size. /// Creates a fractional offset from a specific offset and size.
/// ///
/// The returned [FractionalOffset] describes the position of the /// The returned [FractionalOffset] describes the position of the
/// [Offset] in the [Size], as a fraction of the [Size]. /// [Offset] in the [Size], as a fraction of the [Size].
factory FractionalOffset.fromOffsetAndSize(Offset offset, Size size) { factory FractionalOffset.fromOffsetAndSize(Offset offset, Size size) {
assert(size != null);
assert(offset != null);
return FractionalOffset( return FractionalOffset(
offset.dx / size.width, offset.dx / size.width,
offset.dy / size.height, offset.dy / size.height,
...@@ -180,7 +176,6 @@ class FractionalOffset extends Alignment { ...@@ -180,7 +176,6 @@ class FractionalOffset extends Alignment {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static FractionalOffset? lerp(FractionalOffset? a, FractionalOffset? b, double t) { static FractionalOffset? lerp(FractionalOffset? a, FractionalOffset? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -45,12 +45,6 @@ Offset positionDependentBox({ ...@@ -45,12 +45,6 @@ Offset positionDependentBox({
double verticalOffset = 0.0, double verticalOffset = 0.0,
double margin = 10.0, double margin = 10.0,
}) { }) {
assert(size != null);
assert(childSize != null);
assert(target != null);
assert(verticalOffset != null);
assert(preferBelow != null);
assert(margin != null);
// VERTICAL DIRECTION // VERTICAL DIRECTION
final bool fitsBelow = target.dy + verticalOffset + childSize.height <= size.height - margin; final bool fitsBelow = target.dy + verticalOffset + childSize.height <= size.height - margin;
final bool fitsAbove = target.dy - verticalOffset - childSize.height >= margin; final bool fitsAbove = target.dy - verticalOffset - childSize.height >= margin;
......
...@@ -20,11 +20,8 @@ class _ColorsAndStops { ...@@ -20,11 +20,8 @@ class _ColorsAndStops {
/// Calculate the color at position [t] of the gradient defined by [colors] and [stops]. /// Calculate the color at position [t] of the gradient defined by [colors] and [stops].
Color _sample(List<Color> colors, List<double> stops, double t) { Color _sample(List<Color> colors, List<double> stops, double t) {
assert(colors != null);
assert(colors.isNotEmpty); assert(colors.isNotEmpty);
assert(stops != null);
assert(stops.isNotEmpty); assert(stops.isNotEmpty);
assert(t != null);
if (t <= stops.first) { if (t <= stops.first) {
return colors.first; return colors.first;
} }
...@@ -107,7 +104,6 @@ class GradientRotation extends GradientTransform { ...@@ -107,7 +104,6 @@ class GradientRotation extends GradientTransform {
@override @override
Matrix4 transform(Rect bounds, {TextDirection? textDirection}) { Matrix4 transform(Rect bounds, {TextDirection? textDirection}) {
assert(bounds != null);
final double sinRadians = math.sin(radians); final double sinRadians = math.sin(radians);
final double oneMinusCosRadians = 1 - math.cos(radians); final double oneMinusCosRadians = 1 - math.cos(radians);
final Offset center = bounds.center; final Offset center = bounds.center;
...@@ -170,7 +166,7 @@ abstract class Gradient { ...@@ -170,7 +166,7 @@ abstract class Gradient {
required this.colors, required this.colors,
this.stops, this.stops,
this.transform, this.transform,
}) : assert(colors != null); });
/// The colors the gradient should obtain at each of the stops. /// The colors the gradient should obtain at each of the stops.
/// ///
...@@ -311,7 +307,6 @@ abstract class Gradient { ...@@ -311,7 +307,6 @@ abstract class Gradient {
/// ///
/// {@macro dart.ui.shadow.lerp} /// {@macro dart.ui.shadow.lerp}
static Gradient? lerp(Gradient? a, Gradient? b, double t) { static Gradient? lerp(Gradient? a, Gradient? b, double t) {
assert(t != null);
Gradient? result; Gradient? result;
if (b != null) { if (b != null) {
result = b.lerpFrom(a, t); // if a is null, this must return non-null result = b.lerpFrom(a, t); // if a is null, this must return non-null
...@@ -388,9 +383,7 @@ class LinearGradient extends Gradient { ...@@ -388,9 +383,7 @@ class LinearGradient extends Gradient {
super.stops, super.stops,
this.tileMode = TileMode.clamp, this.tileMode = TileMode.clamp,
super.transform, super.transform,
}) : assert(begin != null), });
assert(end != null),
assert(tileMode != null);
/// The offset at which stop 0.0 of the gradient is placed. /// The offset at which stop 0.0 of the gradient is placed.
/// ///
...@@ -493,7 +486,6 @@ class LinearGradient extends Gradient { ...@@ -493,7 +486,6 @@ class LinearGradient extends Gradient {
/// Values for `t` are usually obtained from an [Animation<double>], such as /// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController]. /// an [AnimationController].
static LinearGradient? lerp(LinearGradient? a, LinearGradient? b, double t) { static LinearGradient? lerp(LinearGradient? a, LinearGradient? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -644,10 +636,7 @@ class RadialGradient extends Gradient { ...@@ -644,10 +636,7 @@ class RadialGradient extends Gradient {
this.focal, this.focal,
this.focalRadius = 0.0, this.focalRadius = 0.0,
super.transform, super.transform,
}) : assert(center != null), });
assert(radius != null),
assert(tileMode != null),
assert(focalRadius != null);
/// The center of the gradient, as an offset into the (-1.0, -1.0) x (1.0, 1.0) /// The center of the gradient, as an offset into the (-1.0, -1.0) x (1.0, 1.0)
/// square describing the gradient which will be mapped onto the paint box. /// square describing the gradient which will be mapped onto the paint box.
...@@ -776,7 +765,6 @@ class RadialGradient extends Gradient { ...@@ -776,7 +765,6 @@ class RadialGradient extends Gradient {
/// Values for `t` are usually obtained from an [Animation<double>], such as /// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController]. /// an [AnimationController].
static RadialGradient? lerp(RadialGradient? a, RadialGradient? b, double t) { static RadialGradient? lerp(RadialGradient? a, RadialGradient? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -943,10 +931,7 @@ class SweepGradient extends Gradient { ...@@ -943,10 +931,7 @@ class SweepGradient extends Gradient {
super.stops, super.stops,
this.tileMode = TileMode.clamp, this.tileMode = TileMode.clamp,
super.transform, super.transform,
}) : assert(center != null), });
assert(startAngle != null),
assert(endAngle != null),
assert(tileMode != null);
/// The center of the gradient, as an offset into the (-1.0, -1.0) x (1.0, 1.0) /// The center of the gradient, as an offset into the (-1.0, -1.0) x (1.0, 1.0)
/// square describing the gradient which will be mapped onto the paint box. /// square describing the gradient which will be mapped onto the paint box.
...@@ -1047,7 +1032,6 @@ class SweepGradient extends Gradient { ...@@ -1047,7 +1032,6 @@ class SweepGradient extends Gradient {
/// Values for `t` are usually obtained from an [Animation<double>], such as /// Values for `t` are usually obtained from an [Animation<double>], such as
/// an [AnimationController]. /// an [AnimationController].
static SweepGradient? lerp(SweepGradient? a, SweepGradient? b, double t) { static SweepGradient? lerp(SweepGradient? a, SweepGradient? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
......
...@@ -99,7 +99,6 @@ class ImageCache { ...@@ -99,7 +99,6 @@ class ImageCache {
/// returning it to its original value will therefore immediately clear the /// returning it to its original value will therefore immediately clear the
/// cache. /// cache.
set maximumSize(int value) { set maximumSize(int value) {
assert(value != null);
assert(value >= 0); assert(value >= 0);
if (value == maximumSize) { if (value == maximumSize) {
return; return;
...@@ -139,7 +138,6 @@ class ImageCache { ...@@ -139,7 +138,6 @@ class ImageCache {
/// returning it to its original value will therefore immediately clear the /// returning it to its original value will therefore immediately clear the
/// cache. /// cache.
set maximumSizeBytes(int value) { set maximumSizeBytes(int value) {
assert(value != null);
assert(value >= 0); assert(value >= 0);
if (value == _maximumSizeBytes) { if (value == _maximumSizeBytes) {
return; return;
...@@ -240,7 +238,6 @@ class ImageCache { ...@@ -240,7 +238,6 @@ class ImageCache {
/// ///
/// * [ImageProvider], for providing images to the [Image] widget. /// * [ImageProvider], for providing images to the [Image] widget.
bool evict(Object key, { bool includeLive = true }) { bool evict(Object key, { bool includeLive = true }) {
assert(includeLive != null);
if (includeLive) { if (includeLive) {
// Remove from live images - the cache will not be able to mark // Remove from live images - the cache will not be able to mark
// it as complete, and it might be getting evicted because it // it as complete, and it might be getting evicted because it
...@@ -324,8 +321,6 @@ class ImageCache { ...@@ -324,8 +321,6 @@ class ImageCache {
/// no completers are cached and `null` is returned instead of a new /// no completers are cached and `null` is returned instead of a new
/// completer. /// completer.
ImageStreamCompleter? putIfAbsent(Object key, ImageStreamCompleter Function() loader, { ImageErrorListener? onError }) { ImageStreamCompleter? putIfAbsent(Object key, ImageStreamCompleter Function() loader, { ImageErrorListener? onError }) {
assert(key != null);
assert(loader != null);
TimelineTask? timelineTask; TimelineTask? timelineTask;
TimelineTask? listenerTask; TimelineTask? listenerTask;
if (!kReleaseMode) { if (!kReleaseMode) {
...@@ -613,8 +608,7 @@ abstract class _CachedImageBase { ...@@ -613,8 +608,7 @@ abstract class _CachedImageBase {
_CachedImageBase( _CachedImageBase(
this.completer, { this.completer, {
this.sizeBytes, this.sizeBytes,
}) : assert(completer != null), }) : handle = completer.keepAlive();
handle = completer.keepAlive();
final ImageStreamCompleter completer; final ImageStreamCompleter completer;
int? sizeBytes; int? sizeBytes;
......
...@@ -348,7 +348,6 @@ abstract class ImageProvider<T extends Object> { ...@@ -348,7 +348,6 @@ abstract class ImageProvider<T extends Object> {
/// See the Lifecycle documentation on [ImageProvider] for more information. /// See the Lifecycle documentation on [ImageProvider] for more information.
@nonVirtual @nonVirtual
ImageStream resolve(ImageConfiguration configuration) { ImageStream resolve(ImageConfiguration configuration) {
assert(configuration != null);
final ImageStream stream = createStream(configuration); final ImageStream stream = createStream(configuration);
// Load the key (potentially asynchronously), set up an error handling zone, // Load the key (potentially asynchronously), set up an error handling zone,
// and call resolveStreamForKey. // and call resolveStreamForKey.
...@@ -407,7 +406,6 @@ abstract class ImageProvider<T extends Object> { ...@@ -407,7 +406,6 @@ abstract class ImageProvider<T extends Object> {
required ImageConfiguration configuration, required ImageConfiguration configuration,
ImageErrorListener? handleError, ImageErrorListener? handleError,
}) { }) {
assert(configuration != null);
final Completer<ImageCacheStatus?> completer = Completer<ImageCacheStatus?>(); final Completer<ImageCacheStatus?> completer = Completer<ImageCacheStatus?>();
_createErrorHandlerAndKey( _createErrorHandlerAndKey(
configuration, configuration,
...@@ -635,9 +633,7 @@ class AssetBundleImageKey { ...@@ -635,9 +633,7 @@ class AssetBundleImageKey {
required this.bundle, required this.bundle,
required this.name, required this.name,
required this.scale, required this.scale,
}) : assert(bundle != null), });
assert(name != null),
assert(scale != null);
/// The bundle from which the image will be obtained. /// The bundle from which the image will be obtained.
/// ///
...@@ -733,10 +729,6 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe ...@@ -733,10 +729,6 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe
PaintingBinding.instance.imageCache.evict(key); PaintingBinding.instance.imageCache.evict(key);
rethrow; rethrow;
} }
if (buffer == null) {
PaintingBinding.instance.imageCache.evict(key);
throw StateError('Unable to read data');
}
return decode(buffer); return decode(buffer);
} }
ByteData data; ByteData data;
...@@ -748,10 +740,6 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe ...@@ -748,10 +740,6 @@ abstract class AssetBundleImageProvider extends ImageProvider<AssetBundleImageKe
PaintingBinding.instance.imageCache.evict(key); PaintingBinding.instance.imageCache.evict(key);
rethrow; rethrow;
} }
if (data == null) {
PaintingBinding.instance.imageCache.evict(key);
throw StateError('Unable to read data');
}
return decodeDepreacted!(data.buffer.asUint8List()); return decodeDepreacted!(data.buffer.asUint8List());
} }
} }
...@@ -803,8 +791,7 @@ class ResizeImage extends ImageProvider<ResizeImageKey> { ...@@ -803,8 +791,7 @@ class ResizeImage extends ImageProvider<ResizeImageKey> {
this.width, this.width,
this.height, this.height,
this.allowUpscaling = false, this.allowUpscaling = false,
}) : assert(width != null || height != null), }) : assert(width != null || height != null);
assert(allowUpscaling != null);
/// The [ImageProvider] that this class wraps. /// The [ImageProvider] that this class wraps.
final ImageProvider imageProvider; final ImageProvider imageProvider;
...@@ -950,9 +937,7 @@ class FileImage extends ImageProvider<FileImage> { ...@@ -950,9 +937,7 @@ class FileImage extends ImageProvider<FileImage> {
/// Creates an object that decodes a [File] as an image. /// Creates an object that decodes a [File] as an image.
/// ///
/// The arguments must not be null. /// The arguments must not be null.
const FileImage(this.file, { this.scale = 1.0 }) const FileImage(this.file, { this.scale = 1.0 });
: assert(file != null),
assert(scale != null);
/// The file to decode into an image. /// The file to decode into an image.
final File file; final File file;
...@@ -1045,9 +1030,7 @@ class MemoryImage extends ImageProvider<MemoryImage> { ...@@ -1045,9 +1030,7 @@ class MemoryImage extends ImageProvider<MemoryImage> {
/// Creates an object that decodes a [Uint8List] buffer as an image. /// Creates an object that decodes a [Uint8List] buffer as an image.
/// ///
/// The arguments must not be null. /// The arguments must not be null.
const MemoryImage(this.bytes, { this.scale = 1.0 }) const MemoryImage(this.bytes, { this.scale = 1.0 });
: assert(bytes != null),
assert(scale != null);
/// The bytes to decode into an image. /// The bytes to decode into an image.
/// ///
...@@ -1204,8 +1187,7 @@ class ExactAssetImage extends AssetBundleImageProvider { ...@@ -1204,8 +1187,7 @@ class ExactAssetImage extends AssetBundleImageProvider {
this.scale = 1.0, this.scale = 1.0,
this.bundle, this.bundle,
this.package, this.package,
}) : assert(assetName != null), });
assert(scale != null);
/// The name of the asset. /// The name of the asset.
final String assetName; final String assetName;
...@@ -1266,9 +1248,7 @@ class NetworkImageLoadException implements Exception { ...@@ -1266,9 +1248,7 @@ class NetworkImageLoadException implements Exception {
/// Creates a [NetworkImageLoadException] with the specified http [statusCode] /// Creates a [NetworkImageLoadException] with the specified http [statusCode]
/// and [uri]. /// and [uri].
NetworkImageLoadException({required this.statusCode, required this.uri}) NetworkImageLoadException({required this.statusCode, required this.uri})
: assert(uri != null), : _message = 'HTTP request failed, statusCode: $statusCode, $uri';
assert(statusCode != null),
_message = 'HTTP request failed, statusCode: $statusCode, $uri';
/// The HTTP status code from the server. /// The HTTP status code from the server.
final int statusCode; final int statusCode;
......
...@@ -244,7 +244,7 @@ class AssetImage extends AssetBundleImageProvider { ...@@ -244,7 +244,7 @@ class AssetImage extends AssetBundleImageProvider {
this.assetName, { this.assetName, {
this.bundle, this.bundle,
this.package, this.package,
}) : assert(assetName != null); });
/// The name of the main asset from the set of images to choose from. See the /// The name of the main asset from the set of images to choose from. See the
/// documentation for the [AssetImage] class itself for details. /// documentation for the [AssetImage] class itself for details.
......
...@@ -23,9 +23,7 @@ class ImageInfo { ...@@ -23,9 +23,7 @@ class ImageInfo {
/// Both the [image] and the [scale] must not be null. /// Both the [image] and the [scale] must not be null.
/// ///
/// The [debugLabel] may be used to identify the source of this image. /// The [debugLabel] may be used to identify the source of this image.
const ImageInfo({ required this.image, this.scale = 1.0, this.debugLabel }) const ImageInfo({ required this.image, this.scale = 1.0, this.debugLabel });
: assert(image != null),
assert(scale != null);
/// Creates an [ImageInfo] with a cloned [image]. /// Creates an [ImageInfo] with a cloned [image].
/// ///
...@@ -167,7 +165,7 @@ class ImageStreamListener { ...@@ -167,7 +165,7 @@ class ImageStreamListener {
this.onImage, { this.onImage, {
this.onChunk, this.onChunk,
this.onError, this.onError,
}) : assert(onImage != null); });
/// Callback for getting notified that an image is available. /// Callback for getting notified that an image is available.
/// ///
...@@ -623,7 +621,6 @@ abstract class ImageStreamCompleter with Diagnosticable { ...@@ -623,7 +621,6 @@ abstract class ImageStreamCompleter with Diagnosticable {
/// ///
/// This callback will never fire if [removeListener] is never called. /// This callback will never fire if [removeListener] is never called.
void addOnLastListenerRemovedCallback(VoidCallback callback) { void addOnLastListenerRemovedCallback(VoidCallback callback) {
assert(callback != null);
_checkDisposed(); _checkDisposed();
_onLastListenerRemovedCallbacks.add(callback); _onLastListenerRemovedCallbacks.add(callback);
} }
...@@ -631,7 +628,6 @@ abstract class ImageStreamCompleter with Diagnosticable { ...@@ -631,7 +628,6 @@ abstract class ImageStreamCompleter with Diagnosticable {
/// Removes a callback previously supplied to /// Removes a callback previously supplied to
/// [addOnLastListenerRemovedCallback]. /// [addOnLastListenerRemovedCallback].
void removeOnLastListenerRemovedCallback(VoidCallback callback) { void removeOnLastListenerRemovedCallback(VoidCallback callback) {
assert(callback != null);
_checkDisposed(); _checkDisposed();
_onLastListenerRemovedCallbacks.remove(callback); _onLastListenerRemovedCallbacks.remove(callback);
} }
...@@ -789,8 +785,7 @@ class OneFrameImageStreamCompleter extends ImageStreamCompleter { ...@@ -789,8 +785,7 @@ class OneFrameImageStreamCompleter extends ImageStreamCompleter {
/// argument on [FlutterErrorDetails] set to true, meaning that by default the /// argument on [FlutterErrorDetails] set to true, meaning that by default the
/// message is only dumped to the console in debug mode (see [ /// message is only dumped to the console in debug mode (see [
/// FlutterErrorDetails]). /// FlutterErrorDetails]).
OneFrameImageStreamCompleter(Future<ImageInfo> image, { InformationCollector? informationCollector }) OneFrameImageStreamCompleter(Future<ImageInfo> image, { InformationCollector? informationCollector }) {
: assert(image != null) {
image.then<void>(setImage, onError: (Object error, StackTrace stack) { image.then<void>(setImage, onError: (Object error, StackTrace stack) {
reportError( reportError(
context: ErrorDescription('resolving a single-frame image stream'), context: ErrorDescription('resolving a single-frame image stream'),
...@@ -859,8 +854,7 @@ class MultiFrameImageStreamCompleter extends ImageStreamCompleter { ...@@ -859,8 +854,7 @@ class MultiFrameImageStreamCompleter extends ImageStreamCompleter {
String? debugLabel, String? debugLabel,
Stream<ImageChunkEvent>? chunkEvents, Stream<ImageChunkEvent>? chunkEvents,
InformationCollector? informationCollector, InformationCollector? informationCollector,
}) : assert(codec != null), }) : _informationCollector = informationCollector,
_informationCollector = informationCollector,
_scale = scale { _scale = scale {
this.debugLabel = debugLabel; this.debugLabel = debugLabel;
codec.then<void>(_handleCodecReady, onError: (Object error, StackTrace stack) { codec.then<void>(_handleCodecReady, onError: (Object error, StackTrace stack) {
......
...@@ -60,9 +60,7 @@ class InlineSpanSemanticsInformation { ...@@ -60,9 +60,7 @@ class InlineSpanSemanticsInformation {
this.semanticsLabel, this.semanticsLabel,
this.stringAttributes = const <ui.StringAttribute>[], this.stringAttributes = const <ui.StringAttribute>[],
this.recognizer, this.recognizer,
}) : assert(text != null), }) : assert(isPlaceholder == false || (text == '\uFFFC' && semanticsLabel == null && recognizer == null)),
assert(isPlaceholder != null),
assert(isPlaceholder == false || (text == '\uFFFC' && semanticsLabel == null && recognizer == null)),
requiresOwnNode = isPlaceholder || recognizer != null; requiresOwnNode = isPlaceholder || recognizer != null;
/// The text info for a [PlaceholderSpan]. /// The text info for a [PlaceholderSpan].
......
...@@ -18,7 +18,6 @@ class MatrixUtils { ...@@ -18,7 +18,6 @@ class MatrixUtils {
/// ///
/// Otherwise, returns null. /// Otherwise, returns null.
static Offset? getAsTranslation(Matrix4 transform) { static Offset? getAsTranslation(Matrix4 transform) {
assert(transform != null);
final Float64List values = transform.storage; final Float64List values = transform.storage;
// Values are stored in column-major order. // Values are stored in column-major order.
if (values[0] == 1.0 && // col 1 if (values[0] == 1.0 && // col 1
...@@ -45,7 +44,6 @@ class MatrixUtils { ...@@ -45,7 +44,6 @@ class MatrixUtils {
/// ///
/// Otherwise, returns null. /// Otherwise, returns null.
static double? getAsScale(Matrix4 transform) { static double? getAsScale(Matrix4 transform) {
assert(transform != null);
final Float64List values = transform.storage; final Float64List values = transform.storage;
// Values are stored in column-major order. // Values are stored in column-major order.
if (values[1] == 0.0 && // col 1 (value 0 is the scale) if (values[1] == 0.0 && // col 1 (value 0 is the scale)
...@@ -81,7 +79,6 @@ class MatrixUtils { ...@@ -81,7 +79,6 @@ class MatrixUtils {
if (b == null) { if (b == null) {
return isIdentity(a); return isIdentity(a);
} }
assert(a != null && b != null);
return a.storage[0] == b.storage[0] return a.storage[0] == b.storage[0]
&& a.storage[1] == b.storage[1] && a.storage[1] == b.storage[1]
&& a.storage[2] == b.storage[2] && a.storage[2] == b.storage[2]
...@@ -102,7 +99,6 @@ class MatrixUtils { ...@@ -102,7 +99,6 @@ class MatrixUtils {
/// Whether the given matrix is the identity matrix. /// Whether the given matrix is the identity matrix.
static bool isIdentity(Matrix4 a) { static bool isIdentity(Matrix4 a) {
assert(a != null);
return a.storage[0] == 1.0 // col 1 return a.storage[0] == 1.0 // col 1
&& a.storage[1] == 0.0 && a.storage[1] == 0.0
&& a.storage[2] == 0.0 && a.storage[2] == 0.0
...@@ -437,7 +433,6 @@ class MatrixUtils { ...@@ -437,7 +433,6 @@ class MatrixUtils {
/// The transformed rect is then projected back into the plane with z equals /// The transformed rect is then projected back into the plane with z equals
/// 0.0 before computing its bounding rect. /// 0.0 before computing its bounding rect.
static Rect inverseTransformRect(Matrix4 transform, Rect rect) { static Rect inverseTransformRect(Matrix4 transform, Rect rect) {
assert(rect != null);
// As exposed by `unrelated_type_equality_checks`, this assert was a no-op. // As exposed by `unrelated_type_equality_checks`, this assert was a no-op.
// Fixing it introduces a bunch of runtime failures; for more context see: // Fixing it introduces a bunch of runtime failures; for more context see:
// https://github.com/flutter/flutter/pull/31568 // https://github.com/flutter/flutter/pull/31568
...@@ -487,10 +482,7 @@ class MatrixUtils { ...@@ -487,10 +482,7 @@ class MatrixUtils {
double perspective = 0.001, double perspective = 0.001,
Axis orientation = Axis.vertical, Axis orientation = Axis.vertical,
}) { }) {
assert(radius != null);
assert(angle != null);
assert(perspective >= 0 && perspective <= 1.0); assert(perspective >= 0 && perspective <= 1.0);
assert(orientation != null);
// Pre-multiplied matrix of a projection matrix and a view matrix. // Pre-multiplied matrix of a projection matrix and a view matrix.
// //
...@@ -561,8 +553,7 @@ class TransformProperty extends DiagnosticsProperty<Matrix4> { ...@@ -561,8 +553,7 @@ class TransformProperty extends DiagnosticsProperty<Matrix4> {
super.showName, super.showName,
super.defaultValue, super.defaultValue,
super.level, super.level,
}) : assert(showName != null), });
assert(level != null);
@override @override
String valueToString({ TextTreeConfiguration? parentConfiguration }) { String valueToString({ TextTreeConfiguration? parentConfiguration }) {
......
...@@ -30,8 +30,7 @@ class RoundedRectangleBorder extends OutlinedBorder { ...@@ -30,8 +30,7 @@ class RoundedRectangleBorder extends OutlinedBorder {
const RoundedRectangleBorder({ const RoundedRectangleBorder({
super.side, super.side,
this.borderRadius = BorderRadius.zero, this.borderRadius = BorderRadius.zero,
}) : assert(side != null), });
assert(borderRadius != null);
/// The radii for each corner. /// The radii for each corner.
final BorderRadiusGeometry borderRadius; final BorderRadiusGeometry borderRadius;
...@@ -46,7 +45,6 @@ class RoundedRectangleBorder extends OutlinedBorder { ...@@ -46,7 +45,6 @@ class RoundedRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is RoundedRectangleBorder) { if (a is RoundedRectangleBorder) {
return RoundedRectangleBorder( return RoundedRectangleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
...@@ -66,7 +64,6 @@ class RoundedRectangleBorder extends OutlinedBorder { ...@@ -66,7 +64,6 @@ class RoundedRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is RoundedRectangleBorder) { if (b is RoundedRectangleBorder) {
return RoundedRectangleBorder( return RoundedRectangleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
...@@ -165,9 +162,7 @@ class _RoundedRectangleToCircleBorder extends OutlinedBorder { ...@@ -165,9 +162,7 @@ class _RoundedRectangleToCircleBorder extends OutlinedBorder {
this.borderRadius = BorderRadius.zero, this.borderRadius = BorderRadius.zero,
required this.circularity, required this.circularity,
required this.eccentricity, required this.eccentricity,
}) : assert(side != null), });
assert(borderRadius != null),
assert(circularity != null);
final BorderRadiusGeometry borderRadius; final BorderRadiusGeometry borderRadius;
final double circularity; final double circularity;
...@@ -185,7 +180,6 @@ class _RoundedRectangleToCircleBorder extends OutlinedBorder { ...@@ -185,7 +180,6 @@ class _RoundedRectangleToCircleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is RoundedRectangleBorder) { if (a is RoundedRectangleBorder) {
return _RoundedRectangleToCircleBorder( return _RoundedRectangleToCircleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
......
...@@ -76,8 +76,7 @@ class ShapeDecoration extends Decoration { ...@@ -76,8 +76,7 @@ class ShapeDecoration extends Decoration {
this.gradient, this.gradient,
this.shadows, this.shadows,
required this.shape, required this.shape,
}) : assert(!(color != null && gradient != null)), }) : assert(!(color != null && gradient != null));
assert(shape != null);
/// Creates a shape decoration configured to match a [BoxDecoration]. /// Creates a shape decoration configured to match a [BoxDecoration].
/// ///
...@@ -91,7 +90,6 @@ class ShapeDecoration extends Decoration { ...@@ -91,7 +90,6 @@ class ShapeDecoration extends Decoration {
/// transition from a [BoxShape.circle] to [BoxShape.rectangle]). /// transition from a [BoxShape.circle] to [BoxShape.rectangle]).
factory ShapeDecoration.fromBoxDecoration(BoxDecoration source) { factory ShapeDecoration.fromBoxDecoration(BoxDecoration source) {
final ShapeBorder shape; final ShapeBorder shape;
assert(source.shape != null);
switch (source.shape) { switch (source.shape) {
case BoxShape.circle: case BoxShape.circle:
if (source.border != null) { if (source.border != null) {
...@@ -227,7 +225,6 @@ class ShapeDecoration extends Decoration { ...@@ -227,7 +225,6 @@ class ShapeDecoration extends Decoration {
/// and which use [ShapeDecoration.lerp] when interpolating two /// and which use [ShapeDecoration.lerp] when interpolating two
/// [ShapeDecoration]s or a [ShapeDecoration] to or from null. /// [ShapeDecoration]s or a [ShapeDecoration] to or from null.
static ShapeDecoration? lerp(ShapeDecoration? a, ShapeDecoration? b, double t) { static ShapeDecoration? lerp(ShapeDecoration? a, ShapeDecoration? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -299,8 +296,7 @@ class ShapeDecoration extends Decoration { ...@@ -299,8 +296,7 @@ class ShapeDecoration extends Decoration {
/// An object that paints a [ShapeDecoration] into a canvas. /// An object that paints a [ShapeDecoration] into a canvas.
class _ShapeDecorationPainter extends BoxPainter { class _ShapeDecorationPainter extends BoxPainter {
_ShapeDecorationPainter(this._decoration, VoidCallback onChanged) _ShapeDecorationPainter(this._decoration, VoidCallback onChanged)
: assert(_decoration != null), : super(onChanged);
super(onChanged);
final ShapeDecoration _decoration; final ShapeDecoration _decoration;
...@@ -318,7 +314,6 @@ class _ShapeDecorationPainter extends BoxPainter { ...@@ -318,7 +314,6 @@ class _ShapeDecorationPainter extends BoxPainter {
VoidCallback get onChanged => super.onChanged!; VoidCallback get onChanged => super.onChanged!;
void _precache(Rect rect, TextDirection? textDirection) { void _precache(Rect rect, TextDirection? textDirection) {
assert(rect != null);
if (rect == _lastRect && textDirection == _lastTextDirection) { if (rect == _lastRect && textDirection == _lastTextDirection) {
return; return;
} }
...@@ -409,7 +404,6 @@ class _ShapeDecorationPainter extends BoxPainter { ...@@ -409,7 +404,6 @@ class _ShapeDecorationPainter extends BoxPainter {
@override @override
void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) { void paint(Canvas canvas, Offset offset, ImageConfiguration configuration) {
assert(configuration != null);
assert(configuration.size != null); assert(configuration.size != null);
final Rect rect = offset & configuration.size!; final Rect rect = offset & configuration.size!;
final TextDirection? textDirection = configuration.textDirection; final TextDirection? textDirection = configuration.textDirection;
......
...@@ -27,14 +27,13 @@ class StadiumBorder extends OutlinedBorder { ...@@ -27,14 +27,13 @@ class StadiumBorder extends OutlinedBorder {
/// Create a stadium border. /// Create a stadium border.
/// ///
/// The [side] argument must not be null. /// The [side] argument must not be null.
const StadiumBorder({ super.side }) : assert(side != null); const StadiumBorder({ super.side });
@override @override
ShapeBorder scale(double t) => StadiumBorder(side: side.scale(t)); ShapeBorder scale(double t) => StadiumBorder(side: side.scale(t));
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is StadiumBorder) { if (a is StadiumBorder) {
return StadiumBorder(side: BorderSide.lerp(a.side, side, t)); return StadiumBorder(side: BorderSide.lerp(a.side, side, t));
} }
...@@ -57,7 +56,6 @@ class StadiumBorder extends OutlinedBorder { ...@@ -57,7 +56,6 @@ class StadiumBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is StadiumBorder) { if (b is StadiumBorder) {
return StadiumBorder(side: BorderSide.lerp(side, b.side, t)); return StadiumBorder(side: BorderSide.lerp(side, b.side, t));
} }
...@@ -144,8 +142,7 @@ class _StadiumToCircleBorder extends OutlinedBorder { ...@@ -144,8 +142,7 @@ class _StadiumToCircleBorder extends OutlinedBorder {
super.side, super.side,
this.circularity = 0.0, this.circularity = 0.0,
required this.eccentricity, required this.eccentricity,
}) : assert(side != null), });
assert(circularity != null);
final double circularity; final double circularity;
final double eccentricity; final double eccentricity;
...@@ -161,7 +158,6 @@ class _StadiumToCircleBorder extends OutlinedBorder { ...@@ -161,7 +158,6 @@ class _StadiumToCircleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is StadiumBorder) { if (a is StadiumBorder) {
return _StadiumToCircleBorder( return _StadiumToCircleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
...@@ -188,7 +184,6 @@ class _StadiumToCircleBorder extends OutlinedBorder { ...@@ -188,7 +184,6 @@ class _StadiumToCircleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is StadiumBorder) { if (b is StadiumBorder) {
return _StadiumToCircleBorder( return _StadiumToCircleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
...@@ -326,9 +321,7 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder { ...@@ -326,9 +321,7 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder {
super.side, super.side,
this.borderRadius = BorderRadius.zero, this.borderRadius = BorderRadius.zero,
this.rectilinearity = 0.0, this.rectilinearity = 0.0,
}) : assert(side != null), });
assert(borderRadius != null),
assert(rectilinearity != null);
final BorderRadiusGeometry borderRadius; final BorderRadiusGeometry borderRadius;
...@@ -345,7 +338,6 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder { ...@@ -345,7 +338,6 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpFrom(ShapeBorder? a, double t) { ShapeBorder? lerpFrom(ShapeBorder? a, double t) {
assert(t != null);
if (a is StadiumBorder) { if (a is StadiumBorder) {
return _StadiumToRoundedRectangleBorder( return _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(a.side, side, t), side: BorderSide.lerp(a.side, side, t),
...@@ -372,7 +364,6 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder { ...@@ -372,7 +364,6 @@ class _StadiumToRoundedRectangleBorder extends OutlinedBorder {
@override @override
ShapeBorder? lerpTo(ShapeBorder? b, double t) { ShapeBorder? lerpTo(ShapeBorder? b, double t) {
assert(t != null);
if (b is StadiumBorder) { if (b is StadiumBorder) {
return _StadiumToRoundedRectangleBorder( return _StadiumToRoundedRectangleBorder(
side: BorderSide.lerp(side, b.side, t), side: BorderSide.lerp(side, b.side, t),
......
...@@ -468,8 +468,8 @@ class _StarGenerator { ...@@ -468,8 +468,8 @@ class _StarGenerator {
required this.rotation, required this.rotation,
required this.squash, required this.squash,
}) : assert(points > 1), }) : assert(points > 1),
assert(innerRadiusRatio == null || innerRadiusRatio <= 1), assert(innerRadiusRatio <= 1),
assert(innerRadiusRatio == null || innerRadiusRatio >= 0), assert(innerRadiusRatio >= 0),
assert(squash >= 0), assert(squash >= 0),
assert(squash <= 1), assert(squash <= 1),
assert(pointRounding >= 0), assert(pointRounding >= 0),
...@@ -484,7 +484,6 @@ class _StarGenerator { ...@@ -484,7 +484,6 @@ class _StarGenerator {
final double valleyRounding; final double valleyRounding;
final double rotation; final double rotation;
final double squash; final double squash;
bool get isStar => innerRadiusRatio != null;
Path generate(Rect rect) { Path generate(Rect rect) {
final double radius = rect.shortestSide / 2; final double radius = rect.shortestSide / 2;
......
...@@ -347,8 +347,7 @@ class StrutStyle with Diagnosticable { ...@@ -347,8 +347,7 @@ class StrutStyle with Diagnosticable {
this.forceStrutHeight, this.forceStrutHeight,
String? debugLabel, String? debugLabel,
String? package, String? package,
}) : assert(textStyle != null), }) : assert(fontSize == null || fontSize > 0),
assert(fontSize == null || fontSize > 0),
assert(leading == null || leading >= 0), assert(leading == null || leading >= 0),
assert(package == null || fontFamily != null || fontFamilyFallback != null), assert(package == null || fontFamily != null || fontFamilyFallback != null),
fontFamily = fontFamily != null ? (package == null ? fontFamily : 'packages/$package/$fontFamily') : textStyle.fontFamily, fontFamily = fontFamily != null ? (package == null ? fontFamily : 'packages/$package/$fontFamily') : textStyle.fontFamily,
......
...@@ -74,8 +74,7 @@ class PlaceholderDimensions { ...@@ -74,8 +74,7 @@ class PlaceholderDimensions {
required this.alignment, required this.alignment,
this.baseline, this.baseline,
this.baselineOffset, this.baselineOffset,
}) : assert(size != null), });
assert(alignment != null);
/// A constant representing an empty placeholder. /// A constant representing an empty placeholder.
static const PlaceholderDimensions empty = PlaceholderDimensions(size: Size.zero, alignment: ui.PlaceholderAlignment.bottom); static const PlaceholderDimensions empty = PlaceholderDimensions(size: Size.zero, alignment: ui.PlaceholderAlignment.bottom);
...@@ -329,10 +328,7 @@ class TextPainter { ...@@ -329,10 +328,7 @@ class TextPainter {
TextWidthBasis textWidthBasis = TextWidthBasis.parent, TextWidthBasis textWidthBasis = TextWidthBasis.parent,
ui.TextHeightBehavior? textHeightBehavior, ui.TextHeightBehavior? textHeightBehavior,
}) : assert(text == null || text.debugAssertIsValid()), }) : assert(text == null || text.debugAssertIsValid()),
assert(textAlign != null),
assert(textScaleFactor != null),
assert(maxLines == null || maxLines > 0), assert(maxLines == null || maxLines > 0),
assert(textWidthBasis != null),
_text = text, _text = text,
_textAlign = textAlign, _textAlign = textAlign,
_textDirection = textDirection, _textDirection = textDirection,
...@@ -527,7 +523,6 @@ class TextPainter { ...@@ -527,7 +523,6 @@ class TextPainter {
TextAlign get textAlign => _textAlign; TextAlign get textAlign => _textAlign;
TextAlign _textAlign; TextAlign _textAlign;
set textAlign(TextAlign value) { set textAlign(TextAlign value) {
assert(value != null);
if (_textAlign == value) { if (_textAlign == value) {
return; return;
} }
...@@ -571,7 +566,6 @@ class TextPainter { ...@@ -571,7 +566,6 @@ class TextPainter {
double get textScaleFactor => _textScaleFactor; double get textScaleFactor => _textScaleFactor;
double _textScaleFactor; double _textScaleFactor;
set textScaleFactor(double value) { set textScaleFactor(double value) {
assert(value != null);
if (_textScaleFactor == value) { if (_textScaleFactor == value) {
return; return;
} }
...@@ -666,7 +660,6 @@ class TextPainter { ...@@ -666,7 +660,6 @@ class TextPainter {
TextWidthBasis get textWidthBasis => _textWidthBasis; TextWidthBasis get textWidthBasis => _textWidthBasis;
TextWidthBasis _textWidthBasis; TextWidthBasis _textWidthBasis;
set textWidthBasis(TextWidthBasis value) { set textWidthBasis(TextWidthBasis value) {
assert(value != null);
if (_textWidthBasis == value) { if (_textWidthBasis == value) {
return; return;
} }
...@@ -734,7 +727,6 @@ class TextPainter { ...@@ -734,7 +727,6 @@ class TextPainter {
ui.ParagraphStyle _createParagraphStyle([ TextDirection? defaultTextDirection ]) { ui.ParagraphStyle _createParagraphStyle([ TextDirection? defaultTextDirection ]) {
// The defaultTextDirection argument is used for preferredLineHeight in case // The defaultTextDirection argument is used for preferredLineHeight in case
// textDirection hasn't yet been set. // textDirection hasn't yet been set.
assert(textAlign != null);
assert(textDirection != null || defaultTextDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.'); assert(textDirection != null || defaultTextDirection != null, 'TextPainter.textDirection must be set to a non-null value before using the TextPainter.');
return _text!.style?.getParagraphStyle( return _text!.style?.getParagraphStyle(
textAlign: textAlign, textAlign: textAlign,
...@@ -847,7 +839,6 @@ class TextPainter { ...@@ -847,7 +839,6 @@ class TextPainter {
/// Valid only after [layout] has been called. /// Valid only after [layout] has been called.
double computeDistanceToActualBaseline(TextBaseline baseline) { double computeDistanceToActualBaseline(TextBaseline baseline) {
assert(_debugAssertTextLayoutIsValid); assert(_debugAssertTextLayoutIsValid);
assert(baseline != null);
switch (baseline) { switch (baseline) {
case TextBaseline.alphabetic: case TextBaseline.alphabetic:
return _paragraph!.alphabeticBaseline; return _paragraph!.alphabeticBaseline;
...@@ -1134,7 +1125,6 @@ class TextPainter { ...@@ -1134,7 +1125,6 @@ class TextPainter {
Offset get _emptyOffset { Offset get _emptyOffset {
assert(_debugAssertTextLayoutIsValid); // implies textDirection is non-null assert(_debugAssertTextLayoutIsValid); // implies textDirection is non-null
assert(textAlign != null);
switch (textAlign) { switch (textAlign) {
case TextAlign.left: case TextAlign.left:
return Offset.zero; return Offset.zero;
...@@ -1199,7 +1189,6 @@ class TextPainter { ...@@ -1199,7 +1189,6 @@ class TextPainter {
return; return;
} }
final int offset = position.offset; final int offset = position.offset;
assert(position.affinity != null);
Rect? rect; Rect? rect;
switch (position.affinity) { switch (position.affinity) {
case TextAffinity.upstream: { case TextAffinity.upstream: {
...@@ -1244,8 +1233,6 @@ class TextPainter { ...@@ -1244,8 +1233,6 @@ class TextPainter {
ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight, ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
}) { }) {
assert(_debugAssertTextLayoutIsValid); assert(_debugAssertTextLayoutIsValid);
assert(boxHeightStyle != null);
assert(boxWidthStyle != null);
return _paragraph!.getBoxesForRange( return _paragraph!.getBoxesForRange(
selection.start, selection.start,
selection.end, selection.end,
......
...@@ -291,7 +291,6 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati ...@@ -291,7 +291,6 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
} }
if (children != null) { if (children != null) {
for (final InlineSpan child in children!) { for (final InlineSpan child in children!) {
assert(child != null);
child.build( child.build(
builder, builder,
textScaleFactor: textScaleFactor, textScaleFactor: textScaleFactor,
...@@ -452,18 +451,6 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati ...@@ -452,18 +451,6 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
assert(() { assert(() {
if (children != null) { if (children != null) {
for (final InlineSpan child in children!) { for (final InlineSpan child in children!) {
if (child == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary('TextSpan contains a null child.'),
ErrorDescription(
'A TextSpan object with a non-null child list should not have any nulls in its child list.',
),
toDiagnosticsNode(
name: 'The full text in question was',
style: DiagnosticsTreeStyle.errorProperty,
),
]);
}
assert(child.debugAssertIsValid()); assert(child.debugAssertIsValid());
} }
} }
...@@ -590,14 +577,7 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati ...@@ -590,14 +577,7 @@ class TextSpan extends InlineSpan implements HitTestTarget, MouseTrackerAnnotati
return const <DiagnosticsNode>[]; return const <DiagnosticsNode>[];
} }
return children!.map<DiagnosticsNode>((InlineSpan child) { return children!.map<DiagnosticsNode>((InlineSpan child) {
// `child` has a non-nullable return type, but might be null when running return child.toDiagnosticsNode();
// with weak checking, so we need to null check it anyway (and ignore the
// warning that the null-handling logic is dead code).
if (child != null) {
return child.toDiagnosticsNode();
} else {
return DiagnosticsNode.message('<null child>');
}
}).toList(); }).toList();
} }
} }
...@@ -504,7 +504,6 @@ class TextStyle with Diagnosticable { ...@@ -504,7 +504,6 @@ class TextStyle with Diagnosticable {
}) : fontFamily = package == null ? fontFamily : 'packages/$package/$fontFamily', }) : fontFamily = package == null ? fontFamily : 'packages/$package/$fontFamily',
_fontFamilyFallback = fontFamilyFallback, _fontFamilyFallback = fontFamilyFallback,
_package = package, _package = package,
assert(inherit != null),
assert(color == null || foreground == null, _kColorForegroundWarning), assert(color == null || foreground == null, _kColorForegroundWarning),
assert(backgroundColor == null || background == null, _kColorBackgroundWarning); assert(backgroundColor == null || background == null, _kColorBackgroundWarning);
...@@ -961,21 +960,10 @@ class TextStyle with Diagnosticable { ...@@ -961,21 +960,10 @@ class TextStyle with Diagnosticable {
String? package, String? package,
TextOverflow? overflow, TextOverflow? overflow,
}) { }) {
assert(fontSizeFactor != null);
assert(fontSizeDelta != null);
assert(fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0)); assert(fontSize != null || (fontSizeFactor == 1.0 && fontSizeDelta == 0.0));
assert(fontWeightDelta != null);
assert(fontWeight != null || fontWeightDelta == 0.0); assert(fontWeight != null || fontWeightDelta == 0.0);
assert(letterSpacingFactor != null);
assert(letterSpacingDelta != null);
assert(letterSpacing != null || (letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0)); assert(letterSpacing != null || (letterSpacingFactor == 1.0 && letterSpacingDelta == 0.0));
assert(wordSpacingFactor != null);
assert(wordSpacingDelta != null);
assert(wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0)); assert(wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0));
assert(heightFactor != null);
assert(heightDelta != null);
assert(decorationThicknessFactor != null);
assert(decorationThicknessDelta != null);
assert(decorationThickness != null || (decorationThicknessFactor == 1.0 && decorationThicknessDelta == 0.0)); assert(decorationThickness != null || (decorationThicknessFactor == 1.0 && decorationThicknessDelta == 0.0));
String? modifiedDebugLabel; String? modifiedDebugLabel;
...@@ -1106,7 +1094,6 @@ class TextStyle with Diagnosticable { ...@@ -1106,7 +1094,6 @@ class TextStyle with Diagnosticable {
/// as if they have a [background] paint (creating a new [Paint] if necessary /// as if they have a [background] paint (creating a new [Paint] if necessary
/// based on the [backgroundColor] property). /// based on the [backgroundColor] property).
static TextStyle? lerp(TextStyle? a, TextStyle? b, double t) { static TextStyle? lerp(TextStyle? a, TextStyle? b, double t) {
assert(t != null);
if (a == null && b == null) { if (a == null && b == null) {
return null; return null;
} }
...@@ -1332,7 +1319,6 @@ class TextStyle with Diagnosticable { ...@@ -1332,7 +1319,6 @@ class TextStyle with Diagnosticable {
double? height, double? height,
StrutStyle? strutStyle, StrutStyle? strutStyle,
}) { }) {
assert(textScaleFactor != null);
assert(maxLines == null || maxLines > 0); assert(maxLines == null || maxLines > 0);
final ui.TextLeadingDistribution? leadingDistribution = this.leadingDistribution; final ui.TextLeadingDistribution? leadingDistribution = this.leadingDistribution;
final ui.TextHeightBehavior? effectiveTextHeightBehavior = textHeightBehavior final ui.TextHeightBehavior? effectiveTextHeightBehavior = textHeightBehavior
......
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