pub repository
mirror.p-hatan.irasync
2.0.6Utility functions and classes related to the 'dart:async' library.
Readme
Contains utility classes in the style of dart:async to work with asynchronous
computations.
-
The
AsyncCacheclass allows expensive asynchronous computations values to be cached for a period of time. -
The
AsyncMemoizerclass makes it easy to only run an asynchronous operation once on demand. -
The
CancelableOperationclass 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 aCancelableCompleter. -
The delegating wrapper classes allow users to easily add functionality on top of existing instances of core types from
dart:async. These includeDelegatingFuture,DelegatingStream,DelegatingStreamSubscription,DelegatingStreamConsumer,DelegatingSink,DelegatingEventSink, andDelegatingStreamSink.The delegating classes all have
.typed()constructors which allow users to cast the generic type parameters in a way that's safe for strong mode. For example, iffutureis aFuture<dynamic>and you know it actually contains anint, you can writeDelegatingFuture.typed<int>(future). -
The
FutureGroupclass makes it easy to wait until a group of features that may change over time completes. -
The
LazyStreamclass allows a stream to be initialized lazily when.listen()is first called. -
The
NullStreamSinkclass is an implementation ofStreamSinkthat discards all events. -
The
RestartableTimerclass extendsTimerwith areset()method. -
The
Resultclass that can hold either a value or an error. It provides various utilities for converting to and fromFutures andStreams. -
The
StreamGroupclass merges a collection of streams into a single output stream. -
The
StreamQueueclass allows a stream to be consumed event-by-event rather than being pushed whichever events as soon as they arrive. -
The
StreamSplitterclass allows a stream to be duplicated into multiple identical streams. -
The
StreamZipclass combines multiple streams into a single stream of lists of events. -
This package contains a number of
StreamTransformers.SingleSubscriptionTransformerconverts a broadcast stream to a single-subscription stream, andtypedStreamTransformercasts the type of aStream. It also defines a transformer type forStreamSinks,StreamSinkTransformer. -
The
SubscriptionStreamclass wraps aStreamSubscriptionso it can be re-used as aStream.
Changelog
2.0.6
- Add further support for Dart 2.0 library changes to
Stream.
2.0.5
- Fix Dart 2.0 runtime cast errors in
StreamQueue.
2.0.4
-
Add support for Dart 2.0 library changes to
StreamandStreamTransformer. Changed classes that implementStreamTransformerto extendStreamTransformerBase, and changed signatures offirstWhere,lastWhere, andsingleWhereon classes extendingStream. See also issue 31847.
2.0.3
- Fix a bug in
StreamQueue.startTransaction()and related methods when rejecting a transaction that isn't the oldest request in the queue.
2.0.2
- Add support for Dart 2.0 library changes to class
Timer.
2.0.1
- Fix a fuzzy arrow type warning.
2.0.0
-
Remove deprecated public
result.dartandstream_zip.dartlibraries and deprecated classesReleaseStreamTransformerandCaptureStreamTransformer. -
Add
captureAllandflattenListstatic methods toResult. -
Change
ErrorResultto not be generic and always be aResult<Null>. That makes an error independent of the type of result it occurs instead of.
1.13.3
- Make
TypeSafeStreamextendStreaminstead of implementing it. This ensures that new methods onStreamare automatically picked up, they will go through thelistenmethod which type-checks every event.
1.13.2
- Fix a type-warning.
1.13.1
- Use
FutureOrfor various APIs that had previously useddynamic.
1.13.0
-
Add
collectBytesandcollectBytesCancelablefunctions which collects list-of-byte events into a single byte list. -
Fix a bug where rejecting a
StreamQueueTransactionwould throw aStateErrorifStreamQueue.resthad been called on one of its child queues. -
StreamQueue.withTransaction()now properly returns whether or not the transaction was committed.
1.12.0
-
Add an
AsyncCacheclass that caches asynchronous operations for a period of time. -
Add
StreamQueue.peekandStreamQueue.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 aCancelableOperationthat can be canceled without affecting the queue. -
Add
StreamQueue.eventsDispatchedwhich counts the number of events that have been dispatched by a given queue. -
Add a
subscriptionTransformer()function to createStreamTransformers that modify the behavior of subscriptions to a stream.
1.11.3
- Fix strong-mode warning against the signature of Future.then
1.11.1
- Fix new strong-mode warnings introduced in Dart 1.17.0.
1.11.0
-
Add a
typedStreamTransformer()function. This wraps an untypedStreamTransformerwith 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 untypedStreamSinkTransformerwith the correct type parameters, and asserts the types of arguments passed in to the resulting sink.
1.10.0
-
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
DelegatingStreamclass. This is behaviorally identical toStreamViewfromdart: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. -
ErrorResultnow takes a type parameter. -
Result.asErrornow returns aResult<T>.
1.9.0
-
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.releaseSinkTransformershould be used instead.
1.8.0
-
Added
StreamSinkCompleter, for creating aStreamSinknow 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 ofStreamSinkthat discards all events.
1.7.0
- Added
SingleSubscriptionTransformer, aStreamTransformerthat converts a broadcast stream into a single-subscription stream.
1.6.0
-
Added
CancelableOperation.valueOrCancellation(), which allows users to be notified when an operation is canceled elsewhere. -
Added
StreamSinkTransformerwhich transforms events before they're passed to aStreamSink, similarly to howStreamTransformertransforms events after they're emitted by a stream.
1.5.0
- Added
LazyStream, which forwards to the return value of a callback that's only called when the stream is listened to.
1.4.0
-
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.
1.3.0
-
Added
StreamCompleterclass for creating a stream now and providing its events later as another stream. -
Added
StreamQueueclass which allows requesting events from a stream before they are avilable. It is like aStreamIteratorthat can queue requests. -
Added
SubscriptionStreamwhich creates a single-subscription stream from an existing stream subscription. -
Added a
ResultFutureclass for synchronously accessing the result of a wrapped future. -
Added
FutureGroup.onIdleandFutureGroup.isIdle, which provide visibility into whether a group is actively waiting on any futures. -
Add an
AsyncMemoizerclass 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.
1.2.0
-
Added a
FutureGroupclass for waiting for a group of futures, potentially of unknown size, to complete. -
Added a
StreamGroupclass for merging the events of a group of streams, potentially of unknown size. -
Added a
StreamSplitterclass for splitting a stream into multiple new streams.
1.1.1
- Updated SDK version constraint to at least 1.9.0.
1.1.0
- ChangeLog starts here.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add asyncpubspec.yaml
name: async
version: 2.0.6
author: Dart Team <misc@dartlang.org>
description: Utility functions and classes related to the 'dart:async' library.
homepage: https://www.github.com/dart-lang/async
environment:
sdk: ">=2.0.0-dev.23.0 <2.0.0"
dependencies:
collection: "^1.5.0"
dev_dependencies:
fake_async: "^0.1.2"
stack_trace: "^1.0.0"
test: "^0.12.0"
# For building and testing with DDC
build_runner: ^0.7.11
build_web_compilers: ^0.3.1
build_test: ^0.10.1
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.1 | 2013-05-09T19:57:55.309210Z | Download | 4a3718012904af165564773a9f1419d7fbb78ed0d17d0e0407da9b3483f3cf0d |
| 0.1.2 | 2013-05-10T11:50:50.000590Z | Download | e0eca6b8da47df3768f7929e06cd6da8adab4b935b08e794eadf8635cf946e6f |
| 0.1.3 | 2013-05-10T13:21:44.285590Z | Download | 51c01bd5e8aad6697cad6fe52ee86669f948829c621bc24f2d3be9e2ecc12c06 |
| 0.1.4 | 2013-05-10T13:36:16.887820Z | Download | 31ef33b5ba87aedd7f1a19587a1abf5bb473bd2a4e02775b91f1c1e6d034f6b4 |
| 0.1.5 | 2013-05-11T11:23:55.758990Z | Download | 5ac12abaf51605fd42a2722a444b1a4e8e2ddf9298828852f4e7f0371c46bb7b |
| 0.1.6 | 2013-05-16T15:29:04.421620Z | Download | e5304fe4ad16409ecd80dc13df2fd11d2ded001c660fc89cf4dc0a37dfcde545 |
| 0.1.7 | 2013-05-19T15:11:52.985160Z | Download | 50a27385522338aabb3ac3dec623ee5bcbc3c2e7c3d7126a732c86dcc9bb74e7 |
| 0.1.7+201305222207 | 2013-05-22T16:10:44.994990Z | Download | 035aa65313b4b774f0015af0454a795cfcffba818564a033062c110edb248317 |
| 0.1.7+201306072346 | 2013-06-07T17:49:45.113850Z | Download | f4a521d11e2d0877a3790709dc43f2fd03cffaf3da2f2df17e1d09f611017d46 |
| 0.1.7+201307031741 | 2013-07-03T11:48:50.947200Z | Download | d2b3ce152ad8e612e947b1d731f005054361e26dac0ed7c4b6df3d5d8d75a13b |
| 0.1.7+201307031742 | 2013-07-03T19:05:08.176060Z | Download | 344e1bb3be6cbca76374d48c9121c32797276864841183199a2a6b573dc69609 |
| 0.9.0 | 2013-12-20T07:55:14.448740Z | Download | 6202b752ec3752f73262359e581280546b4edb29c0e2a76f42ae34287eaa6f53 |
| 0.9.1 | 2013-12-20T07:59:24.010290Z | Download | f5ecc1610d58da86e47534b0d629d10c613b4657e4238d1c90e90eb37f8ef88f |
| 1.0.0 | 2014-05-23T10:16:40.183920Z | Download | 1ea8eabe0091e6d3e1e5e775adf1f3a7acb6decf6f8074ba3b27cd7c18fe89c3 |
| 1.0.0+1 | 2014-09-23T23:54:50.461760Z | Download | 9581d96389cb5c29ea47e2dc86a05e64ecdd8f1bce510f5a818bb589a004560b |
| 1.1.0 | 2015-02-23T10:37:37.021290Z | Download | 26f7f1945efc2c2867ca7b859cc10ff74ec23462abc043338f2d2a70d8ae157c |
| 1.2.0 | 2015-06-26T01:31:29.961Z | Download | 46185e8d898f3aeba8aef67fd32668a9ba06d3453a28c2ef469099045541c86f |
| 1.3.0 | 2015-08-10T22:58:52.711Z | Download | 7fae6155525ad7ea1cf2ca8fa4233c2f7f46ecd01b0ee45e80952fba3b8df26e |
| 1.4.0 | 2015-10-28T21:12:12.691Z | Download | 3cbdedcb20b6d23cad8385f78b2d51923446a9b2460f159609bf481c22169937 |
| 1.5.0 | 2015-12-14T21:11:03.601Z | Download | fb97c1d0b6988c109ed595ae0ae81646a902baa34e3dd33484587ccf40ef10b2 |
| 1.6.0 | 2016-01-11T21:08:35.240Z | Download | 72eacc23eb50d9f8e9b125f9c3227171b97a6a56a16b0aa640ddabd2a45c30e5 |
| 1.7.0 | 2016-01-19T21:48:34.276Z | Download | 31e8581c3bae9dce0f36c8aa20435edb416cfad846339dd9d06fc4e764e4a898 |
| 1.8.0 | 2016-01-25T22:40:48.099Z | Download | 6d572ba7196bffdee9954c0658fcfd38aa153d89e19401011837d0fd2397a743 |
| 1.9.0 | 2016-03-08T20:24:44.980Z | Download | 014e28c8db01a353521dffadfedb3897b6bb12513f32ed30bd3da89a335a2f25 |
| 1.10.0 | 2016-04-12T20:43:48.102Z | Download | 2cac3acaeccbbbf06da0e9ddb4f39563d2ddba8eaadecc264e8a447ddfa79726 |
| 1.11.0 | 2016-05-09T19:32:19.103Z | Download | f5ebc0575ec1d5a6685588e6328372a8fce050e239d780f1386f00a357be8a59 |
| 1.11.1 | 2016-07-19T21:54:57.028Z | Download | 67a206d9c0d20853452a5171b5b4ca6c913113c98d587fb8e7e67cc84915edbe |
| 1.11.2 | 2016-09-27T10:19:58.629Z | Download | 5cf581e8f2cb26b44e248e0343fafd74200e9a76a747ddf49f10c35926e226b5 |
| 1.11.3 | 2016-10-24T19:32:27.480Z | Download | 32f0274fbb1ef81316c7bb6dc33f7b596e25c3dda5b8550163a6f0a89712cdc0 |
| 1.12.0 | 2017-01-24T21:33:26.930Z | Download | 78eda22375d22c73ebfa349d425e8795b375f28a021ee2b14a50827605120213 |
| 1.13.0 | 2017-02-06T23:40:52.928Z | Download | ead4b9f1659bea63524fdabfd3f7a85e3e571fd9d02279f562ae9bddee58962b |
| 1.13.1 | 2017-02-15T22:22:07.249Z | Download | 76aa69249e190c953b8af8915ab0888540e81c26c0913e7607c92a751ab7a4ab |
| 1.13.2 | 2017-02-20T11:35:45.837Z | Download | 9a4d52aee772a2048fb9afdbd3d30db32edc02df007cd08cf7125be9b70ffef1 |
| 1.13.3 | 2017-05-17T22:00:45.977128Z | Download | e7fe9543e3eb70aeab9392f6f3be7de1ee9e1ccc8a479f25b810573757278d4d |
| 2.0.0 | 2017-08-29T13:49:43.256559Z | Download | 45cc90762b42ee06a1774dceb5f4dc84e2d901391bd491037312c1fbd621e0e7 |
| 2.0.1 | 2017-10-03T22:32:59.068034Z | Download | 380a0735795c8f29f8ae2d202a3da46ae127271daf26dfddeea8f4e803a85739 |
| 2.0.2 | 2018-01-03T03:41:44.208651Z | Download | b7f2720560d779466ded671a643cca71c14b6c82cc0215c46665d3bf0c29d567 |
| 2.0.3 | 2018-01-05T20:50:25.355766Z | Download | 25d79db1fc80a750ce26faed51373f6d3bb0ffc0815842ef08746e33c12bcbfe |
| 2.0.4 | 2018-02-10T01:22:31.088103Z | Download | 2b12e44c72f2f4bd6cbe394482b5d1ddcd17993ca528b2c6bfdcfe59d6a4b620 |
| 2.0.5 | 2018-02-27T22:30:35.110633Z | Download | cf9f704ef15b6bb6afd8e0d1b504dbb347a69590bb7b04c53773d81f25fa6662 |
| 2.0.6 | 2018-03-03T01:15:16.283524Z | Download | 3267d6ef569fde74ae9fbeacbc1a01f50692a6b8c0bbc077122a31b86df34335 |
| 2.0.7 | 2018-05-03T12:04:40.446419Z | Download | 5a428e659da752990c9e131d91caece5423dcb1581bc7b0ae3eeb940f142ecbd |
| 2.0.8 | 2018-07-19T23:28:23.633548Z | Download | bf54d1c770347fa8a69744d8ca99cff05395327d5ed5f49d50c0cf7dfa50ec7f |
| 2.1.0 | 2019-03-22T21:13:26.288737Z | Download | 04c4b8d77df9abaae352a430cefa6c578aa3564188ae059c9e10fd90877e30b9 |
| 2.2.0 | 2019-04-05T23:14:34.472839Z | Download | b5cabd24ffa0b4574cf219f785f9b44324755bdf0b54ab51f28b984a0941c272 |
| 2.3.0 | 2019-07-17T21:29:31.916792Z | Download | a94b444ed3f20f5bea1bd2d53c90973deca6854cbecd4a062ec4c3985e54f68e |
| 2.4.0 | 2019-10-03T21:34:26.015916Z | Download | 621073b7f52bdf82367abf19e627aadc25605b70b98055e320962f028d7b2c55 |
| 2.4.1 | 2020-03-16T20:56:16.307853Z | Download | f560f36042276f08b83b57c778630fc8bbb8e2da57aabbfc76761f57191d1d85 |
| 2.4.2 | 2020-07-06T19:47:36.437663Z | Download | 116007395b5353cd12fc55d253821a81a3213bb258ae6edc65d0c14a4af1bdff |
| 2.5.0-nullsafety | 2020-07-29T15:44:39.776394Z | Download | 410f63355f8c7e5c2432c9a2812cf3dd85c1617908be647962570860ff07f280 |
| 2.5.0-nullsafety.1 | 2020-09-22T20:16:36.871293Z | Download | aadbf84dffaac01f28c38ac8cdfda7fb1549a838c8e396aac0b208ce9133bf48 |
| 2.5.0-nullsafety.2 | 2020-10-23T19:52:11.266636Z | Download | 6a28806a4efd6a7e5e98f8f5909001c08667d5dcfc24062141e6a08cbe27b45c |
| 2.5.0-nullsafety.3 | 2020-11-03T22:12:25.228263Z | Download | 083dec0c8bd92288c1e1d2c5d6fe7e90b4f37167c934d920d09a8baf7ff75b40 |
| 2.5.0 | 2021-02-02T19:16:54.685555Z | Download | 6eda8392a48ae1de7ea438c91a4ba3e77205f043e7013102a424863aa6db368f |
| 2.6.0 | 2021-04-28T15:37:21.006039Z | Download | 558fff0367e75875e136f628336a7c599cb5b77bf83cad58312847d243d54a44 |
| 2.6.1 | 2021-05-03T17:53:21.555243Z | Download | e21a2193873e85591cdf0c9a4059139adacc87391d8330774d3f67076863015c |
| 2.7.0 | 2021-05-20T18:01:27.236564Z | Download | 5386f08a54d1b58d17e4bc6dee9b6b24a256b1fc7e2addba11945eec144edad8 |
| 2.8.0 | 2021-07-22T19:42:55.266980Z | Download | e475379bece740d9a7365bea46b7d0f832e1ec30b41b6c99a8dd3373909f51da |
| 2.8.1 | 2021-07-22T21:12:39.664998Z | Download | d810902f3971b6e8e2f9153c361d51bf1af1b99c25087906a50945e828a17591 |
| 2.8.2 | 2021-08-10T10:51:54.863741Z | Download | db4766341bd8ecb66556f31ab891a5d596ef829221993531bd64a8e6342f0cda |
| 2.9.0 | 2022-04-01T00:57:01.007445Z | Download | 271b8899fc99f9df4f4ed419fa14e2fff392c7b2c162fbb87b222e2e963ddc73 |
| 2.10.0 | 2022-10-24T18:59:06.776238Z | Download | bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 |
| 2.11.0 | 2023-03-10T21:42:31.687779Z | Download | 947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c |
| 2.12.0 | 2024-10-16T08:39:22.633388Z | Download | d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 |
| 2.13.0 | 2025-02-06T18:36:01.591754Z | Download | 758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb |
| 2.13.1 | 2026-03-26T00:53:13.853173Z | Download | e2eb0491ba5ddb6177742d2da23904574082139b07c1e33b8503b9f46f3e1a37 |
Dependencies
collection "^1.5.0"