From 3f401a1930f44f82aa6e2b0f6c7ba340628e92ce Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Thu, 16 Jun 2022 22:38:07 +0200 Subject: [PATCH] Ignore uses of soon-to-be deprecated `NullThrownError`. (#105693) --- packages/flutter/lib/src/foundation/assertions.dart | 5 ++--- packages/flutter/test/foundation/assertions_test.dart | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/flutter/lib/src/foundation/assertions.dart b/packages/flutter/lib/src/foundation/assertions.dart index 0e353151bdb8..7239b077503b 100644 --- a/packages/flutter/lib/src/foundation/assertions.dart +++ b/packages/flutter/lib/src/foundation/assertions.dart @@ -395,8 +395,7 @@ class FlutterErrorDetails with Diagnosticable { /// subsequently be reported using [FlutterError.onError]. /// /// The [exception] must not be null; other arguments can be left to - /// their default values. (`throw null` results in a - /// [NullThrownError] exception.) + /// their default values. const FlutterErrorDetails({ required this.exception, this.stack, @@ -671,7 +670,7 @@ class FlutterErrorDetails with Diagnosticable { super.debugFillProperties(properties); final DiagnosticsNode verb = ErrorDescription('thrown${ context != null ? ErrorDescription(" $context") : ""}'); final Diagnosticable? diagnosticable = _exceptionToDiagnosticable(); - if (exception is NullThrownError) { + if (exception is NullThrownError) { // ignore: deprecated_member_use properties.add(ErrorDescription('The null value was $verb.')); } else if (exception is num) { properties.add(ErrorDescription('The number $exception was $verb.')); diff --git a/packages/flutter/test/foundation/assertions_test.dart b/packages/flutter/test/foundation/assertions_test.dart index 88e1d1da468f..7428e38e494c 100644 --- a/packages/flutter/test/foundation/assertions_test.dart +++ b/packages/flutter/test/foundation/assertions_test.dart @@ -60,7 +60,7 @@ void main() { ); expect( FlutterErrorDetails( - exception: NullThrownError(), + exception: NullThrownError(), // ignore: deprecated_member_use library: 'LIBRARY', context: ErrorDescription('CONTEXTING'), informationCollector: () sync* { @@ -113,6 +113,7 @@ void main() { '═════════════════════════════════════════════════════════════════\n', ); expect( + // ignore: deprecated_member_use FlutterErrorDetails(exception: NullThrownError()).toString(), '══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞══════════════════════\n' 'The null value was thrown.\n'