- Require Dart 3.4.
- Move to
dart-lang/core
monorepo.
- Add
CancelableOperation.fromValue
. - Add
StreamExtensions.listenAndBuffer
, which buffers events from a stream before it has a listener.
- Add
CancelableOperation.thenOperation
which gives more flexibility to complete the resulting operation. - Add
CancelableCompleter.completeOperation
. - Require Dart 2.18.
- Potentially Breaking The default
propagateCancel
argument toCancelableOperation.then
changed fromfalse
totrue
. In most usages this won't have a meaningful difference in behavior, but in usages where the behavior is important propagation is the more common need. If there are anyCancelableOperation
with multiple listeners where canceling subsequent computation using.then
shouldn't also cancel the original operation, passpropagateCancel: false
. - Add
StreamExtensions.firstOrNull
. - Add a
CancelableOperation.fromSubscription()
static factory. - Add a
CancelableOperation.race()
static method. - Update
StreamGroup
methods that return aFuture<dynamic>
today to return aFuture<void>
instead. - Deprecated
AsyncCache.fetchStream
. - Make
AsyncCache.ephemeral
invalidate itself immediately when the returned future completes, rather than wait for a later timer event.
- Deprecate
EventSinkBase
,StreamSinkBase
,IOSinkBase
.
- Don't ignore broadcast streams added to a
StreamGroup
that doesn't have an active listener but previously had listeners and contains a single subscription inner stream.
- Add
EventSinkBase
,StreamSinkBase
, andIOSinkBase
classes to make it easier to implement custom sinks. - Improve performance for
ChunkedStreamReader
by creating fewer internal sublists and specializing to create views forUint8List
chunks.
- Add a
Stream.slices()
extension method. - Fix a bug where
CancelableOperation.then
may invoke theonValue
callback, even if it had been canceled beforeCancelableOperation.value
completes. - Fix a bug in
CancelableOperation.isComplete
where it may appear to be complete and no longer be cancelable when it in fact could still be canceled.
- When
StreamGroup.stream.listen()
is called, gracefully handle component streams throwing errors when theirStream.listen()
methods are called.
- Add a
StreamCloser
class, which is aStreamTransformer
that allows the caller to force the stream to emit a done event. - Added
ChunkedStreamReader
for reading chunked streams without managing buffers. - Add extensions on
StreamSink
, includingStreamSink.transform()
for applyingStreamSinkTransformer
s andStreamSink.rejectErrors()
. - Add
StreamGroup.isIdle
andStreamGroup.onIdle
. - Add
StreamGroup.isClosed
andFutureGroup.isClosed
getters.
- Stable release for null safety.
- Update SDK constraints to
>=2.12.0-0 <3.0.0
based on beta release guidelines.
- Remove the unusable setter
CancelableOperation.operation=
. This was mistakenly added to the public API but could never be called. - Allow 2.12.0 dev SDK versions.
- Allow 2.10 stable and 2.11.0 dev SDK versions.
- Migrate this package to null safety.
StreamQueue
starts listening immediately to broadcast strings.
- Deprecate
DelegatingStream.typed
. UseStream.cast
instead. - Deprecate
DelegatingStreamSubcription.typed
andDelegatingStreamConsumer.typed
. For each of these theStream
should be cast to the correct type before being used. - Deprecate
DelegatingStreamSink.typed
.DelegatingSink.typed
,DelegatingEventSink.typed
,DelegatingStreamConsumer.typed
. For each of these a newStreamController
can be constructed to forward to the sink.StreamController<T>()..stream.cast<S>().pipe(sink)
- Deprecate
typedStreamTransformer
. Cast after transforming instead. - Deprecate
StreamSinkTransformer.typed
since there was no usage. - Improve docs for
CancelablOperation.fromFuture
, indicate thatisCompleted
startstrue
.
- Add
StreamGroup.mergeBroadcast()
utility.
- Implement
RestartableTimer.tick
.
- Add
then
toCancelableOperation
.
- Fix
CancelableOperation.valueOrCancellation
's type signature - Add
isCanceled
andisCompleted
toCancelableOperation
.
- Set max SDK version to
<3.0.0
. - Deprecate
DelegatingFuture.typed
, it is not necessary in Dart 2.
- Fix Dart 2 runtime errors.
- Stop using deprecated constants from the SDK.
- Add further support for Dart 2.0 library changes to
Stream
.
- Fix Dart 2.0 runtime cast errors in
StreamQueue
.
- Add support for Dart 2.0 library changes to
Stream
andStreamTransformer
. Changed classes that implementStreamTransformer
to extendStreamTransformerBase
, and changed signatures offirstWhere
,lastWhere
, andsingleWhere
on classes extendingStream
. See also issue 31847.
- Fix a bug in
StreamQueue.startTransaction()
and related methods when rejecting a transaction that isn't the oldest request in the queue.
- Add support for Dart 2.0 library changes to class
Timer
.
- Fix a fuzzy arrow type warning.
-
Remove deprecated public
result.dart
andstream_zip.dart
libraries and deprecated classesReleaseStreamTransformer
andCaptureStreamTransformer
. -
Add
captureAll
andflattenList
static methods toResult
. -
Change
ErrorResult
to not be generic and always be aResult<Null>
. That makes an error independent of the type of result it occurs instead of.
- Make
TypeSafeStream
extendStream
instead of implementing it. This ensures that new methods onStream
are automatically picked up, they will go through thelisten
method which type-checks every event.
- Fix a type-warning.
- Use
FutureOr
for various APIs that had previously useddynamic
.
-
Add
collectBytes
andcollectBytesCancelable
functions which collects list-of-byte events into a single byte list. -
Fix a bug where rejecting a
StreamQueueTransaction
would throw aStateError
ifStreamQueue.rest
had been called on one of its child queues. -
StreamQueue.withTransaction()
now properly returns whether or not the transaction was committed.
-
Add an
AsyncCache
class that caches asynchronous operations for a period of time. -
Add
StreamQueue.peek
andStreamQueue.lookAheead
. These allow users to look at events without consuming them. -
Add
StreamQueue.startTransaction()
andStreamQueue.withTransaction()
. These allow users to conditionally consume events based on their values. -
Add
StreamQueue.cancelable()
, which allows users to easily make aCancelableOperation
that can be canceled without affecting the queue. -
Add
StreamQueue.eventsDispatched
which counts the number of events that have been dispatched by a given queue. -
Add a
subscriptionTransformer()
function to createStreamTransformer
s that modify the behavior of subscriptions to a stream.
- Fix strong-mode warning against the signature of Future.then
- Fix new strong-mode warnings introduced in Dart 1.17.0.
-
Add a
typedStreamTransformer()
function. This wraps an untypedStreamTransformer
with the correct type parameters, and asserts the types of events as they're emitted from the transformed stream. -
Add a
StreamSinkTransformer.typed()
static method. This wraps an untypedStreamSinkTransformer
with the correct type parameters, and asserts the types of arguments passed in to the resulting sink.
-
Add
DelegatingFuture.typed()
,DelegatingStreamSubscription.typed()
,DelegatingStreamConsumer.typed()
,DelegatingSink.typed()
,DelegatingEventSink.typed()
, andDelegatingStreamSink.typed()
static methods. These wrap untyped instances of these classes with the correct type parameter, and assert the types of values as they're accessed. -
Add a
DelegatingStream
class. This is behaviorally identical toStreamView
fromdart:async
, but it follows this package's naming conventions and provides aDelegatingStream.typed()
static method. -
Fix all strong mode warnings and add generic method annotations.
-
new StreamQueue()
,new SubscriptionStream()
,new DelegatingStreamSubscription()
,new DelegatingStreamConsumer()
,new DelegatingSink()
,new DelegatingEventSink()
, andnew DelegatingStreamSink()
now take arguments with generic type arguments (for exampleStream<T>
) rather than without (for exampleStream<dynamic>
). Passing a type that wasn'tis
-compatible with the fully-specified generic would already throw an error under some circumstances, so this is not considered a breaking change. -
ErrorResult
now takes a type parameter. -
Result.asError
now returns aResult<T>
.
-
Deprecate top-level libraries other than
package:async/async.dart
, which exports these libraries' interfaces. -
Add
Result.captureStreamTransformer
,Result.releaseStreamTransformer
,Result.captureSinkTransformer
, andResult.releaseSinkTransformer
. -
Deprecate
CaptureStreamTransformer
,ReleaseStreamTransformer
,CaptureSink
, andReleaseSink
.Result.captureStreamTransformer
,Result.releaseStreamTransformer
,Result.captureSinkTransformer
, andResult.releaseSinkTransformer
should be used instead.
-
Added
StreamSinkCompleter
, for creating aStreamSink
now and providing its destination later as another sink. -
Added
StreamCompleter.setError
, a shortcut for emitting a single error event on the resulting stream. -
Added
NullStreamSink
, an implementation ofStreamSink
that discards all events.
- Added
SingleSubscriptionTransformer
, aStreamTransformer
that converts a broadcast stream into a single-subscription stream.
-
Added
CancelableOperation.valueOrCancellation()
, which allows users to be notified when an operation is canceled elsewhere. -
Added
StreamSinkTransformer
which transforms events before they're passed to aStreamSink
, similarly to howStreamTransformer
transforms events after they're emitted by a stream.
- Added
LazyStream
, which forwards to the return value of a callback that's only called when the stream is listened to.
-
Added
AsyncMemoizer.future
, which allows the result to be accessed beforerunOnce()
is called. -
Added
CancelableOperation
, an asynchronous operation that can be canceled. It can be created using aCancelableCompleter
. -
Added
RestartableTimer
, a non-periodic timer that can be reset over and over.
-
Added
StreamCompleter
class for creating a stream now and providing its events later as another stream. -
Added
StreamQueue
class which allows requesting events from a stream before they are avilable. It is like aStreamIterator
that can queue requests. -
Added
SubscriptionStream
which creates a single-subscription stream from an existing stream subscription. -
Added a
ResultFuture
class for synchronously accessing the result of a wrapped future. -
Added
FutureGroup.onIdle
andFutureGroup.isIdle
, which provide visibility into whether a group is actively waiting on any futures. -
Add an
AsyncMemoizer
class for running an asynchronous block of code exactly once. -
Added delegating wrapper classes for a number of core async types:
DelegatingFuture
,DelegatingStreamConsumer
,DelegatingStreamController
,DelegatingSink
,DelegatingEventSink
,DelegatingStreamSink
, andDelegatingStreamSubscription
. These are all simple wrappers that forward all calls to the wrapped objects. They can be used to expose only the desired interface for subclasses, or extended to add extra functionality.
-
Added a
FutureGroup
class for waiting for a group of futures, potentially of unknown size, to complete. -
Added a
StreamGroup
class for merging the events of a group of streams, potentially of unknown size. -
Added a
StreamSplitter
class for splitting a stream into multiple new streams.
- Updated SDK version constraint to at least 1.9.0.
- ChangeLog starts here.