Use onError over catchError

`Future.catchError` is more error prone in null safe dart than `onError`
because return type of the `Function` callback is not statically
enforced and `null` was a common default value which no longer works.

Migrate all calls from `catchError` to `onError` to demonstrate best
practices. The other usages in this package are mostly on
`Future<dynamic>` and mostly look safe, though I can't rule out a type
error in unusual situations.

There was at least one mistake made in the migration of this library -
the code to ignore errors when completing a `CancelableOperation` as an
error after it was already canceled would instead cause a type error to
surface. Fix this and add a test.
11 files changed
tree: c81593fa5c522a89c36eb8c7eb3e02338aada2a2
  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

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