diff --git a/packages/flutter/lib/src/painting/text_span.dart b/packages/flutter/lib/src/painting/text_span.dart index 497abb7297..c057dfc1e9 100644 --- a/packages/flutter/lib/src/painting/text_span.dart +++ b/packages/flutter/lib/src/painting/text_span.dart @@ -366,7 +366,10 @@ class TextSpan extends InlineSpan { assert(() { if (children != null) { for (final InlineSpan child in children!) { - if (child == null) { + // `child` has a non-nullable return type, but might be null when + // running 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) { // ignore: dead_code throw FlutterError.fromParts([ ErrorSummary('TextSpan contains a null child.'), ErrorDescription( @@ -474,9 +477,12 @@ class TextSpan extends InlineSpan { if (children == null) return const []; return children!.map((InlineSpan child) { + // `child` has a non-nullable return type, but might be null when running + // 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 { + } else { // ignore: dead_code return DiagnosticsNode.message(''); } }).toList(); diff --git a/packages/flutter/lib/src/painting/text_style.dart b/packages/flutter/lib/src/painting/text_style.dart index b452f99333..e62cfc90b1 100644 --- a/packages/flutter/lib/src/painting/text_style.dart +++ b/packages/flutter/lib/src/painting/text_style.dart @@ -821,7 +821,6 @@ class TextStyle with Diagnosticable { assert(wordSpacing != null || (wordSpacingFactor == 1.0 && wordSpacingDelta == 0.0)); assert(heightFactor != null); assert(heightDelta != null); - assert(heightFactor != null || (heightFactor == 1.0 && heightDelta == 0.0)); assert(decorationThicknessFactor != null); assert(decorationThicknessDelta != null); assert(decorationThickness != null || (decorationThicknessFactor == 1.0 && decorationThicknessDelta == 0.0));