From af5194dbfd6555d59037562e7d30b731dc98fcfd Mon Sep 17 00:00:00 2001 From: "Lasse R.H. Nielsen" Date: Tue, 24 Mar 2020 16:34:17 +0100 Subject: [PATCH] Prepare Flutter for SDK changes to `runZoned`. (#52953) The `runZoned` method deprecates the `onError` parameter. Invocations using that parameter must use `runZonedGuarded` instead. This prepares Flutter for the deprecation. The same places need to be migrated to using `runZonedGuarded` when the SDK change has been ported to Flutter. Then the deprecated member will be removed in a follow-up CL when the most important packages have been migrated. --- packages/flutter_tools/lib/runner.dart | 2 +- packages/flutter_tools/lib/src/base/async_guard.dart | 2 +- .../flutter_tools/test/general.shard/runner/runner_test.dart | 4 ++-- packages/flutter_tools/test/src/context.dart | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/flutter_tools/lib/runner.dart b/packages/flutter_tools/lib/runner.dart index 536e434bda..4ab1ff6dd6 100644 --- a/packages/flutter_tools/lib/runner.dart +++ b/packages/flutter_tools/lib/runner.dart @@ -68,7 +68,7 @@ Future run( return await _handleToolError( error, stackTrace, verbose, args, reportCrashes, getVersion); } - }, onError: (Object error, StackTrace stackTrace) async { + }, onError: (Object error, StackTrace stackTrace) async { // ignore: deprecated_member_use // If sending a crash report throws an error into the zone, we don't want // to re-try sending the crash report with *that* error. Rather, we want // to send the original error that triggered the crash report. diff --git a/packages/flutter_tools/lib/src/base/async_guard.dart b/packages/flutter_tools/lib/src/base/async_guard.dart index d25cf58f68..237964a43c 100644 --- a/packages/flutter_tools/lib/src/base/async_guard.dart +++ b/packages/flutter_tools/lib/src/base/async_guard.dart @@ -117,7 +117,7 @@ Future asyncGuard( } catch (e, s) { // ignore: avoid_catches_without_on_clauses handleError(e, s); } - }, onError: (Object e, StackTrace s) { + }, onError: (Object e, StackTrace s) { // ignore: deprecated_member_use handleError(e, s); }); diff --git a/packages/flutter_tools/test/general.shard/runner/runner_test.dart b/packages/flutter_tools/test/general.shard/runner/runner_test.dart index 36567a18fe..ae4555e6f8 100644 --- a/packages/flutter_tools/test/general.shard/runner/runner_test.dart +++ b/packages/flutter_tools/test/general.shard/runner/runner_test.dart @@ -55,7 +55,7 @@ void main() { )); return null; }, - onError: (Object error) { + onError: (Object error, StackTrace stack) { // ignore: deprecated_member_use expect(error, 'test exit'); completer.complete(); }, @@ -103,7 +103,7 @@ void main() { )); return null; }, - onError: (Object error) { + onError: (Object error, StackTrace stack) { // ignore: deprecated_member_use expect(error, 'test exit'); completer.complete(); }, diff --git a/packages/flutter_tools/test/src/context.dart b/packages/flutter_tools/test/src/context.dart index 2680cfd33c..1f8181b04e 100644 --- a/packages/flutter_tools/test/src/context.dart +++ b/packages/flutter_tools/test/src/context.dart @@ -158,7 +158,7 @@ void testUsingContext( _printBufferedErrors(context); rethrow; } - }, onError: (dynamic error, StackTrace stackTrace) { + }, onError: (Object error, StackTrace stackTrace) { // ignore: deprecated_member_use io.stdout.writeln(error); io.stdout.writeln(stackTrace); _printBufferedErrors(context);