commit | 18dfa9167be0319e8804610ea0953f084ff3ff42 | [log] [tgz] |
---|---|---|
author | Nate Bosch <nbosch@google.com> | Wed Apr 21 08:50:35 2021 -0700 |
committer | GitHub <noreply@github.com> | Wed Apr 21 08:50:35 2021 -0700 |
tree | 4f7577f1843f29cd30593346e595629171e524b1 | |
parent | bf12b8fe93426447108549adb43c25b52a37680e [diff] |
Style tweaks in stream_queue.dart (#167) - Use a noun phrase to document the `hasNext` getter. The `next` and `peek` getters keep their verb phrase doc comments since the side effects are critical distinctions between these methods. If we were writing this today, `next()` would be a method. - Change `_failClosed()` which returns an error, to `_checkNotClosed()` which checks the condition and optionally closes. Avoid nesting the majority of method behavior in a conditional. - Use `RangeError.checkNotNegative` over a conditional. - Change bare `Future` to `Future<void>` in code examples. - Make `withTransaction` `async` since there is no longer a blocker now that async methods start running synchronously.
Contains utility classes in the style of dart:async
to work with asynchronous computations.
The AsyncCache
class allows expensive asynchronous computations values to be cached for a period of time.
The AsyncMemoizer
class makes it easy to only run an asynchronous operation once on demand.
The CancelableOperation
class defines an operation that can be canceled by its consumer. The producer can then listen for this cancellation and stop producing the future when it's received. It can be created using a CancelableCompleter
.
The delegating wrapper classes allow users to easily add functionality on top of existing instances of core types from dart:async
. These include DelegatingFuture
, DelegatingStream
, DelegatingStreamSubscription
, DelegatingStreamConsumer
, DelegatingSink
, DelegatingEventSink
, and DelegatingStreamSink
.
The FutureGroup
class makes it easy to wait until a group of futures that may change over time completes.
The LazyStream
class allows a stream to be initialized lazily when .listen()
is first called.
The NullStreamSink
class is an implementation of StreamSink
that discards all events.
The RestartableTimer
class extends Timer
with a reset()
method.
The Result
class that can hold either a value or an error. It provides various utilities for converting to and from Future
s and Stream
s.
The StreamGroup
class merges a collection of streams into a single output stream.
The StreamQueue
class allows a stream to be consumed event-by-event rather than being pushed whichever events as soon as they arrive.
The StreamSplitter
class allows a stream to be duplicated into multiple identical streams.
The StreamZip
class combines multiple streams into a single stream of lists of events.
This package contains a number of StreamTransformer
s. SingleSubscriptionTransformer
converts a broadcast stream to a single-subscription stream, and typedStreamTransformer
casts the type of a Stream
. It also defines a transformer type for StreamSink
s, StreamSinkTransformer
.
The SubscriptionStream
class wraps a StreamSubscription
so it can be re-used as a Stream
.