Ignore NullThrownError deprecation (#116135)

* Ignore NullThrownError deprecation

* Fix whitespace
This commit is contained in:
Michael Thomsen
2022-11-29 03:09:56 +01:00
committed by GitHub
parent 8535e716d8
commit d6995aa249
3 changed files with 4 additions and 3 deletions

View File

@@ -672,7 +672,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.'));

View File

@@ -15,7 +15,7 @@ void main() async {
try {
await compute(throwNull, null);
} catch (e) {
if (e is! TypeError && e is! NullThrownError) {
if (e is! TypeError && e is! NullThrownError) { // ignore: deprecated_member_use
throw Exception('compute returned bad result');
}
}

View File

@@ -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'