From a8d57515c30f41bc54a1169119feb0d844c95c89 Mon Sep 17 00:00:00 2001 From: Simon Binder Date: Tue, 7 Jun 2022 14:48:32 +0200 Subject: [PATCH] Avoid overly careful runZoneGuarded --- docs/pubspec.yaml | 1 + drift/lib/src/runtime/cancellation_zone.dart | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/pubspec.yaml b/docs/pubspec.yaml index e29772496..8fd93b8e9 100644 --- a/docs/pubspec.yaml +++ b/docs/pubspec.yaml @@ -41,6 +41,7 @@ dev_dependencies: drift_dev: dependency_overrides: + # Waiting for dartdoc, https://github.com/dart-lang/dartdoc/pull/3033 analyzer: ^4.0.0 moor: path: ../moor diff --git a/drift/lib/src/runtime/cancellation_zone.dart b/drift/lib/src/runtime/cancellation_zone.dart index bceb8e319..04352a3b3 100644 --- a/drift/lib/src/runtime/cancellation_zone.dart +++ b/drift/lib/src/runtime/cancellation_zone.dart @@ -12,9 +12,8 @@ CancellationToken runCancellable( Future Function() operation, ) { final token = CancellationToken(); - runZonedGuarded( - () => operation().then(token._resultCompleter.complete), - token._resultCompleter.completeError, + runZoned( + () => token._resultCompleter.complete(Future.sync(operation)), zoneValues: {_key: token}, );