mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Move away from deprecated NoSuchMethodError to NoSuchMethodError.withInvocation (#63974)
This commit is contained in:
parent
473744df2c
commit
61362cff85
@ -162,22 +162,24 @@ Future<void> main() async {
|
||||
|
||||
test('Error reporting - NoSuchMethodError', () async {
|
||||
expect(console, isEmpty);
|
||||
final dynamic exception = NoSuchMethodError(5, #foo, <dynamic>[2, 4], null); // ignore: deprecated_member_use
|
||||
final dynamic exception = NoSuchMethodError.withInvocation(5,
|
||||
Invocation.method(#foo, <dynamic>[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();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user