Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore uses of soon-to-be deprecated NullThrownError. #105693

Merged
merged 1 commit into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions packages/flutter/lib/src/foundation/assertions.dart
Expand Up @@ -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,
Expand Down Expand Up @@ -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.'));
Expand Down
3 changes: 2 additions & 1 deletion packages/flutter/test/foundation/assertions_test.dart
Expand Up @@ -60,7 +60,7 @@ void main() {
);
expect(
FlutterErrorDetails(
exception: NullThrownError(),
exception: NullThrownError(), // ignore: deprecated_member_use
library: 'LIBRARY',
context: ErrorDescription('CONTEXTING'),
informationCollector: () sync* {
Expand Down Expand Up @@ -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'
Expand Down