Avoid overly careful runZoneGuarded

This commit is contained in:
Simon Binder 2022-06-07 14:48:32 +02:00
parent 9af708773c
commit a8d57515c3
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
2 changed files with 3 additions and 3 deletions

View File

@ -41,6 +41,7 @@ dev_dependencies:
drift_dev: drift_dev:
dependency_overrides: dependency_overrides:
# Waiting for dartdoc, https://github.com/dart-lang/dartdoc/pull/3033
analyzer: ^4.0.0 analyzer: ^4.0.0
moor: moor:
path: ../moor path: ../moor

View File

@ -12,9 +12,8 @@ CancellationToken<T> runCancellable<T>(
Future<T> Function() operation, Future<T> Function() operation,
) { ) {
final token = CancellationToken<T>(); final token = CancellationToken<T>();
runZonedGuarded( runZoned(
() => operation().then(token._resultCompleter.complete), () => token._resultCompleter.complete(Future.sync(operation)),
token._resultCompleter.completeError,
zoneValues: {_key: token}, zoneValues: {_key: token},
); );