Synchronously forward chained cancellations (#239)

Add a test which chains through multiple `.then` calls and then cancels
the original operation. This test passes with the original code, but
starts failing after fixing a bug in `Completer.complete` in the SDK.
https://dart-review.googlesource.com/c/sdk/+/258929

- Add a list of extra completers to forward cancellation. In places
  where the cancellation had been forwarded through a `whenComplete`,
  add to the list of extra cancellations instead. This allows the Future
  return by the outer cancellation to wait for the other callbacks to
  complete before firing.
- When setting up forwarding on an already canceled completer,
  immediately forward the cancellation.
- When forwarding cancellations, don't repeatedly call `_cancel()` on a
  completer which has already been canceled.
- In `race()`, disable cancellation propagation to prevent a cyclic
  cancellation.
4 files changed
tree: 9aeb2556f4d51e0ef66dcdd0bb5dba1b9d674758
  1. .github/
  2. lib/
  3. test/
  4. .gitignore
  5. analysis_options.yaml
  6. AUTHORS
  7. CHANGELOG.md
  8. CONTRIBUTING.md
  9. LICENSE
  10. pubspec.yaml
  11. README.md
README.md

Dart CI pub package package publisher

Contains utility classes in the style of dart:async to work with asynchronous computations.

Package API

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.