Skip to content
This repository was archived by the owner on Oct 17, 2024. It is now read-only.

Commit 695b3ac

Browse files
authored
Migrate to runZonedGuarded (#142)
The `onError` argument to `runZoned` is deprecated. Switch to the supported `runZonedGuarded`. Remove argument types on the function literal since thy can now be inferred. `runZonedGuarded` has a specific function type argument, whereas `onError` was typed as `Function` which did not allow inference on argument types.
1 parent 08508d4 commit 695b3ac

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 2.5.0-nullsafety.3-dev
2+
13
## 2.5.0-nullsafety.2
24

35
* Remove the unusable setter `CancelableOperation.operation=`. This was

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: async
2-
version: 2.5.0-nullsafety.2
2+
version: 2.5.0-nullsafety.3-dev
33

44
description: Utility functions and classes related to the 'dart:async' library.
55
homepage: https://www.github.com/dart-lang/async

test/utils.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ typedef OptionalArgAction = void Function([dynamic a, dynamic b]);
1919
OptionalArgAction unreachable(String name) =>
2020
([a, b]) => fail('Unreachable: $name');
2121

22-
// TODO(nweiz): Use the version of this in test when test#418 is fixed.
2322
/// A matcher that runs a callback in its own zone and asserts that that zone
2423
/// emits an error that matches [matcher].
2524
Matcher throwsZoned(matcher) => predicate((void Function() callback) {
2625
var firstError = true;
27-
runZoned(callback,
28-
onError: expectAsync2((Object error, StackTrace stackTrace) {
26+
runZonedGuarded(
27+
callback,
28+
expectAsync2((error, stackTrace) {
2929
if (firstError) {
3030
expect(error, matcher);
3131
firstError = false;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy