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

Add CancelableOperation.fromValue #225

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Conversation

natebosch
Copy link
Contributor

This is useful in tests which stub behavior for an API which returns CancelableOperation. It has more clear semantics and is shorter than CancelableOperation.fromFuture(Future.value(...)).

Take a T instead of a more general FutureOr<T> to satisfy both cases because it allows simplifying the API with no onCancel support.

This is useful in tests which stub behavior for an API which returns
`CancelableOperation`. It has more clear semantics and is shorter than
`CancelableOperation.fromFuture(Future.value(...))`.

Take a `T` instead of a more general `FutureOr<T>` to satisfy both cases
because it allows simplifying the API with no `onCancel` support.
@natebosch natebosch requested review from jakemac53 and lrhn November 8, 2022 18:59
@natebosch natebosch merged commit c59c7c5 into master Nov 9, 2022
@natebosch natebosch deleted the cancelable-from-value branch November 9, 2022 17:20
mosuem pushed a commit to dart-lang/core that referenced this pull request Oct 14, 2024
This is useful in tests which stub behavior for an API which returns
`CancelableOperation`. It has more clear semantics and is shorter than
`CancelableOperation.fromFuture(Future.value(...))`.

Take a `T` instead of a more general `FutureOr<T>` to satisfy both cases
because it allows simplifying the API with no `onCancel` support.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants