Use runZonedGuarded() instead of deprecated onError. (#69160)
This commit is contained in:
parent
55289324c6
commit
7b86be228e
@ -305,7 +305,7 @@ void main() {
|
|||||||
final FlutterError error = FlutterError('Oops');
|
final FlutterError error = FlutterError('Oops');
|
||||||
double errorCount = 0;
|
double errorCount = 0;
|
||||||
|
|
||||||
runZoned(
|
runZonedGuarded(
|
||||||
() async {
|
() async {
|
||||||
mockHelper.refreshCompleter = Completer<void>.sync();
|
mockHelper.refreshCompleter = Completer<void>.sync();
|
||||||
await tester.pumpWidget(
|
await tester.pumpWidget(
|
||||||
@ -371,7 +371,7 @@ void main() {
|
|||||||
)));
|
)));
|
||||||
expect(mockHelper.invocations, hasLength(5));
|
expect(mockHelper.invocations, hasLength(5));
|
||||||
},
|
},
|
||||||
onError: (dynamic e) {
|
(Object e, StackTrace stack) {
|
||||||
expect(e, error);
|
expect(e, error);
|
||||||
expect(errorCount, 0);
|
expect(errorCount, 0);
|
||||||
errorCount++;
|
errorCount++;
|
||||||
|
@ -152,7 +152,7 @@ void main() {
|
|||||||
|
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZonedGuarded(() async {
|
||||||
final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
|
final Future<void> f = asyncGuard<void>(() => delayedThrow(time))
|
||||||
.catchError((Object e, StackTrace s) {
|
.catchError((Object e, StackTrace s) {
|
||||||
caughtByCatchError = true;
|
caughtByCatchError = true;
|
||||||
@ -165,7 +165,7 @@ void main() {
|
|||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
}
|
}
|
||||||
}, onError: (Object e, StackTrace s) {
|
}, (Object e, StackTrace s) {
|
||||||
caughtByZone = true;
|
caughtByZone = true;
|
||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
@ -188,7 +188,7 @@ void main() {
|
|||||||
|
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZonedGuarded(() async {
|
||||||
final Future<void> f = asyncGuard<void>(
|
final Future<void> f = asyncGuard<void>(
|
||||||
() => delayedThrow(time),
|
() => delayedThrow(time),
|
||||||
onError: (Object e, StackTrace s) {
|
onError: (Object e, StackTrace s) {
|
||||||
@ -203,7 +203,7 @@ void main() {
|
|||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
}
|
}
|
||||||
}, onError: (Object e, StackTrace s) {
|
}, (Object e, StackTrace s) {
|
||||||
caughtByZone = true;
|
caughtByZone = true;
|
||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
@ -226,7 +226,7 @@ void main() {
|
|||||||
|
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZonedGuarded(() async {
|
||||||
final Future<void> f = asyncGuard<void>(
|
final Future<void> f = asyncGuard<void>(
|
||||||
() => delayedThrow(time),
|
() => delayedThrow(time),
|
||||||
onError: (Object e) {
|
onError: (Object e) {
|
||||||
@ -241,7 +241,7 @@ void main() {
|
|||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
}
|
}
|
||||||
}, onError: (Object e, StackTrace s) {
|
}, (Object e, StackTrace s) {
|
||||||
caughtByZone = true;
|
caughtByZone = true;
|
||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
@ -265,7 +265,7 @@ void main() {
|
|||||||
|
|
||||||
final Completer<void> completer = Completer<void>();
|
final Completer<void> completer = Completer<void>();
|
||||||
await FakeAsync().run((FakeAsync time) {
|
await FakeAsync().run((FakeAsync time) {
|
||||||
unawaited(runZoned(() async {
|
unawaited(runZonedGuarded(() async {
|
||||||
final Future<void> f = asyncGuard<void>(
|
final Future<void> f = asyncGuard<void>(
|
||||||
() => delayedThrow(time),
|
() => delayedThrow(time),
|
||||||
onError: (Object e, [StackTrace s]) {
|
onError: (Object e, [StackTrace s]) {
|
||||||
@ -281,7 +281,7 @@ void main() {
|
|||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
}
|
}
|
||||||
}, onError: (Object e, StackTrace s) {
|
}, (Object e, StackTrace s) {
|
||||||
caughtByZone = true;
|
caughtByZone = true;
|
||||||
if (!completer.isCompleted) {
|
if (!completer.isCompleted) {
|
||||||
completer.complete(null);
|
completer.complete(null);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user