Use runZonedGuarded() instead of deprecated onError. (#69160)

This commit is contained in:
Konstantin Scheglov
2020-10-28 08:43:31 -07:00
committed by GitHub
parent 55289324c6
commit 7b86be228e
2 changed files with 10 additions and 10 deletions

View File

@@ -305,7 +305,7 @@ void main() {
final FlutterError error = FlutterError('Oops');
double errorCount = 0;
runZoned(
runZonedGuarded(
() async {
mockHelper.refreshCompleter = Completer<void>.sync();
await tester.pumpWidget(
@@ -371,7 +371,7 @@ void main() {
)));
expect(mockHelper.invocations, hasLength(5));
},
onError: (dynamic e) {
(Object e, StackTrace stack) {
expect(e, error);
expect(errorCount, 0);
errorCount++;

View File

@@ -152,7 +152,7 @@ void main() {
final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async {
unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
.catchError((Object e, StackTrace s) {
caughtByCatchError = true;
@@ -165,7 +165,7 @@ void main() {
if (!completer.isCompleted) {
completer.complete(null);
}
}, onError: (Object e, StackTrace s) {
}, (Object e, StackTrace s) {
caughtByZone = true;
if (!completer.isCompleted) {
completer.complete(null);
@@ -188,7 +188,7 @@ void main() {
final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async {
unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>(
() => delayedThrow(time),
onError: (Object e, StackTrace s) {
@@ -203,7 +203,7 @@ void main() {
if (!completer.isCompleted) {
completer.complete(null);
}
}, onError: (Object e, StackTrace s) {
}, (Object e, StackTrace s) {
caughtByZone = true;
if (!completer.isCompleted) {
completer.complete(null);
@@ -226,7 +226,7 @@ void main() {
final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async {
unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>(
() => delayedThrow(time),
onError: (Object e) {
@@ -241,7 +241,7 @@ void main() {
if (!completer.isCompleted) {
completer.complete(null);
}
}, onError: (Object e, StackTrace s) {
}, (Object e, StackTrace s) {
caughtByZone = true;
if (!completer.isCompleted) {
completer.complete(null);
@@ -265,7 +265,7 @@ void main() {
final Completer<void> completer = Completer<void>();
await FakeAsync().run((FakeAsync time) {
unawaited(runZoned(() async {
unawaited(runZonedGuarded(() async {
final Future<void> f = asyncGuard<void>(
() => delayedThrow(time),
onError: (Object e, [StackTrace s]) {
@@ -281,7 +281,7 @@ void main() {
if (!completer.isCompleted) {
completer.complete(null);
}
}, onError: (Object e, StackTrace s) {
}, (Object e, StackTrace s) {
caughtByZone = true;
if (!completer.isCompleted) {
completer.complete(null);