diff --git a/packages/flutter/test/foundation/error_reporting_test.dart b/packages/flutter/test/foundation/error_reporting_test.dart index a2ee99b983b..2fa48cd78c2 100644 --- a/packages/flutter/test/foundation/error_reporting_test.dart +++ b/packages/flutter/test/foundation/error_reporting_test.dart @@ -162,22 +162,24 @@ Future main() async { test('Error reporting - NoSuchMethodError', () async { expect(console, isEmpty); - final dynamic exception = NoSuchMethodError(5, #foo, [2, 4], null); // ignore: deprecated_member_use + final dynamic exception = NoSuchMethodError.withInvocation(5, + Invocation.method(#foo, [2, 4])); + FlutterError.dumpErrorToConsole(FlutterErrorDetails( exception: exception, )); expect(console.join('\n'), matches( r'^══╡ EXCEPTION CAUGHT BY FLUTTER FRAMEWORK ╞═════════════════════════════════════════════════════════\n' r'The following NoSuchMethodError was thrown:\n' - r'Receiver: 5\n' - r'Tried calling: foo = 2, 4\n' + r'int has no foo method accepting arguments \(_, _\)\n' r'════════════════════════════════════════════════════════════════════════════════════════════════════$', )); console.clear(); FlutterError.dumpErrorToConsole(FlutterErrorDetails( exception: exception, )); - expect(console.join('\n'), 'Another exception was thrown: NoSuchMethodError: Receiver: 5'); + expect(console.join('\n'), + 'Another exception was thrown: NoSuchMethodError: int has no foo method accepting arguments (_, _)'); console.clear(); FlutterError.resetErrorCount(); });