Viewing version 0.8.3+1. Open the latest package page.
rxdart
0.8.3+1Native Dart rx implementation
Readme
RxDart
Build Status codecov Pub Gitter
About
RxDart is a reactive functional programming library for Google Dart, based on ReactiveX.
Google Dart comes with a very decent Streams API out-of-the-box; rather than attempting to provide an alternative to this API, RxDart adds functionality on top of it.
How To Use RxDart
For Example: Reading the Konami Code
void main() {
const konamiKeyCodes = const <int>[
KeyCode.UP,
KeyCode.UP,
KeyCode.DOWN,
KeyCode.DOWN,
KeyCode.LEFT,
KeyCode.RIGHT,
KeyCode.LEFT,
KeyCode.RIGHT,
KeyCode.B,
KeyCode.A];
final result = querySelector('#result');
final keyUp = new Observable<KeyboardEvent>(document.onKeyUp);
keyUp
.map((event) => event.keyCode)
.bufferWithCount(10, 1)
.where((lastTenKeyCodes) => const IterableEquality<int>().equals(lastTenKeyCodes, konamiKeyCodes))
.listen((_) => result.innerHtml = 'KONAMI!');
}
API Overview
RxDart's Observables extend the Stream class. This has two major implications:
- All methods defined on the Stream class exist on RxDart's Observables as well.
- All Observables can be passed to any API that expects a Dart Stream as an input.
Instantiation
Generally speaking, creating a new Observable is either done by wrapping a Dart Stream using the top-level constructor new Observable(), or by calling a factory method on the Observable class.
But to better support Dart's strong mode, combineLatest and zip have been pulled apart into fixed-length constructors.
These methods are supplied as static methods, since Dart's factory methods don't support generic types.
Available Top-level Method
- observable
Usage
var myObservable = new Observable(myStream);
Available Factory Methods
- amb
- concat
- defer
- error
- just
- merge
- never
- periodic
- range (static)
- timer
- tween (static)
Usage
var myObservable = new Observable.merge([myFirstStream, mySecondStream]);
Available Static Methods
- combineLatest (combineLatest2, combineLatest3, combineLatest4, ..., combineLatest9)
- zip (zip2, zip3, zip4, ..., zip9)
Usage
var myObservable = Observable.combineLatest3(
myFirstStream,
mySecondStream,
myThirdStream,
(firstData, secondData, thirdData) => print("$firstData $secondData $thirdData"));
Transformations
Available Methods
- bufferWithCount
- call
- concatMap
- concatWith
- debounce
- dematerialize
- flatMapLatest
- flatMap
- groupBy
- interval
- materialize
- mergeWith
- max
- min
- pluck
- repeat
- retry
- sample
- scan
- skipUntil
- startWith
- startWithMany
- takeUntil
- timeInterval
- timestamp
- throttle
- windowWithCount
- withLatestFrom
- zipWith
Usage
var myObservable = observable(myStream)
.bufferWithCount(5)
.distinct();
Objects
- Observable
- BehaviourSubject
- ReplaySubject
Notable References
Changelog
Refer to the Changelog to get all release notes.
Changelog
0.8.3+1
- rename examples map to example
0.8.3
- added concatWith, zipWith, mergeWith, skipUntil
- cleanup of the examples folder
- cleanup of examples code
- added fibonacci example
- added search GitHub example
0.8.2+1
- moved repo into ReactiveX
- update readme badges accordingly
0.8.2
- added materialize/dematerialize
- added range (factory)
- added timer (factory)
- added timestamp
- added concatMap
0.8.1
- added never constructor
- added error constructor
- moved code coverage to codecov.io
0.8.0
- BREAKING: tap is replaced by call(onData)
- added call, which can take any combination of the following event methods: onCancel, onData, onDone, onError, onListen, onPause, onResume
0.7.1+1
- improved the README file
0.7.1
- added ignoreElements
- added onErrorResumeNext
- added onErrorReturn
- added switchIfEmpty
- added empty factory constructor
0.7.0
- BREAKING: rename combineXXXLatest and zipXXX to a numbered equivalent, for example: combineThreeLatest becomes combineLatest3
- internal refactoring, expose streams/stream transformers as a separate library
0.6.3+4
- changed ofType to use TypeToken
0.6.3+3
- added ofType
0.6.3+2
- added defaultIfEmpty
0.6.3+1
- changed concat, old concat is now concatEager, new concat behaves as expected
0.6.3
- Added withLatestFrom
- Added defer ctr (both thanks to brianegan)
0.6.2
- Added just (thanks to brianegan)
- Added groupBy
- Added amb
0.6.1
- Added concat
0.6.0
- BREAKING: startWith now takes just one parameter instead of an Iterable. To add multiple starting events, please use startWithMany.
- Added BehaviourSubject and ReplaySubject. These implement StreamController.
- BehaviourSubject will notify the last added event upon listening.
- ReplaySubject will notify all past events upon listening.
- DEPRECATED: zip and combineLatest, use their strong-type-friendly alternatives instead (available as static methods on the Observable class, i.e. Observable.combineThreeLatest, Observable.zipFour, ...)
0.5.1
- Added documentation (thanks to dustinlessard-wf)
- Fix tests breaking due to deprecation of expectAsync
- Fix tests to satisfy strong mode requirements
0.5.0
- As of this version, rxdart depends on SDK v1.21.0, to support the newly added generic method type syntax
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.ir
flutter pub add 'rxdart:0.8.3+1'pubspec.yaml
name: rxdart
version: 0.8.3+1
author: Frank Pepermans <frank@igindo.com>
description: Native Dart rx implementation
homepage: https://github.com/ReactiveX/rxdart
environment:
sdk: '>=1.21.0'
dependencies:
dev_dependencies:
browser: ^0.10.0+2
collection: ^1.13.0
react: ^0.8.5
test: ^0.12.5+1
benchmark_harness: ">=1.0.0 <2.0.0"
coverage: ^0.9.2
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | Cached · Upstream SHA-256 matched | Download | 7b2c6e72…523c15 |
| 0.1.0+1 | Cached · Upstream SHA-256 matched | Download | d3b2922d…679f2a |
| 0.1.0+2 | Cached · Upstream SHA-256 matched | Download | edfa980c…d43a9b |
| 0.1.0+3 | Cached · Upstream SHA-256 matched | Download | dc82051d…0285ab |
| 0.1.0+4 | Cached · Upstream SHA-256 matched | Download | 39c33b63…bb88ce |
| 0.1.0+5 | Cached · Upstream SHA-256 matched | Download | b2e90d5e…96e23e |
| 0.1.0+6 | Cached · Upstream SHA-256 matched | Download | e417d502…bb148e |
| 0.2.0 | Cached · Upstream SHA-256 matched | Download | 4fdc3a49…725854 |
| 0.2.0+1 | Cached · Upstream SHA-256 matched | Download | 71d9f48f…f3879d |
| 0.2.0+3 | Cached · Upstream SHA-256 matched | Download | b7742d6d…daea85 |
| 0.3.0 | Cached · Upstream SHA-256 matched | Download | 7eeca94a…2df1ed |
| 0.3.1 | Cached · Upstream SHA-256 matched | Download | fc0a390f…3415e3 |
| 0.3.2 | Cached · Upstream SHA-256 matched | Download | 353a7970…100d09 |
| 0.3.3 | Cached · Upstream SHA-256 matched | Download | 9276f3f4…23c6d5 |
| 0.3.4 | Cached · Upstream SHA-256 matched | Download | 3fa075ce…7b5512 |
| 0.3.5 | Cached · Upstream SHA-256 matched | Download | c6a63b6f…0bdb0b |
| 0.3.6 | Cached · Upstream SHA-256 matched | Download | 9695e85a…ae84a5 |
| 0.3.7 | Cached · Upstream SHA-256 matched | Download | 5eb73e19…e1ba1a |
| 0.3.8 | Cached · Upstream SHA-256 matched | Download | 491112d8…41339d |
| 0.3.8+1 | Cached · Upstream SHA-256 matched | Download | 6e7b0d49…ce7b24 |
| 0.3.9 | Cached · Upstream SHA-256 matched | Download | f3660828…9c9ecc |
| 0.3.10 | Cached · Upstream SHA-256 matched | Download | f2fa34eb…e31b70 |
| 0.3.11 | Cached · Upstream SHA-256 matched | Download | b5c4093d…f1c0a8 |
| 0.3.12 | Cached · Upstream SHA-256 matched | Download | efb6bc41…3ec0c3 |
| 0.3.13 | Cached · Upstream SHA-256 matched | Download | b606e2b9…a97fdd |
| 0.3.14 | Cached · Upstream SHA-256 matched | Download | dd3a48de…129a13 |
| 0.3.15 | Cached · Upstream SHA-256 matched | Download | 14cac08f…61d366 |
| 0.3.16 | Cached · Upstream SHA-256 matched | Download | 45c18814…d6fd01 |
| 0.3.17 | Cached · Upstream SHA-256 matched | Download | 472670ab…5b128b |
| 0.3.18 | Cached · Upstream SHA-256 matched | Download | 003af73f…e496cc |
| 0.3.19 | Cached · Upstream SHA-256 matched | Download | 83ea5ffd…0b8779 |
| 0.3.20 | Cached · Upstream SHA-256 matched | Download | de431744…2ac9ab |
| 0.3.21 | Cached · Upstream SHA-256 matched | Download | 17c84b88…99609b |
| 0.3.22 | Cached · Upstream SHA-256 matched | Download | 5cb985a3…2e939a |
| 0.3.24 | Cached · Upstream SHA-256 matched | Download | 6baac2a7…c4ef60 |
| 0.3.25 | Cached · Upstream SHA-256 matched | Download | 55b1b751…3d371f |
| 0.4.0 | Cached · Upstream SHA-256 matched | Download | f16b4c82…f1b045 |
| 0.4.1 | Cached · Upstream SHA-256 matched | Download | a78d65a3…b204ec |
| 0.4.2 | Cached · Upstream SHA-256 matched | Download | bff12d4e…331493 |
| 0.4.3 | Cached · Upstream SHA-256 matched | Download | 95e65662…cbb822 |
| 0.4.4 | Cached · Upstream SHA-256 matched | Download | 839ac5b0…c194d5 |
| 0.4.5 | Cached · Upstream SHA-256 matched | Download | a104543d…2fce1d |
| 0.4.6 | Cached · Upstream SHA-256 matched | Download | 9a272d97…292d0d |
| 0.4.7 | Cached · Upstream SHA-256 matched | Download | d62c6d02…a7a464 |
| 0.4.8 | Cached · Upstream SHA-256 matched | Download | b6df4602…5f5e1f |
| 0.5.0 | Cached · Upstream SHA-256 matched | Download | af8cbcbd…8167a7 |
| 0.5.1 | Cached · Upstream SHA-256 matched | Download | c3c1a58f…2c9691 |
| 0.6.0 | Cached · Upstream SHA-256 matched | Download | c4ebe9fd…55994a |
| 0.6.1 | Cached · Upstream SHA-256 matched | Download | 59e032b1…a36028 |
| 0.6.1+1 | Cached · Upstream SHA-256 matched | Download | 8d218fbb…48c0b2 |
| 0.6.1+2 | Cached · Upstream SHA-256 matched | Download | e660f25c…01610f |
| 0.6.2 | Cached · Upstream SHA-256 matched | Download | 245a4d94…e2d7d9 |
| 0.6.2+1 | Cached · Upstream SHA-256 matched | Download | 06bd3411…0436d4 |
| 0.6.3 | Cached · Upstream SHA-256 matched | Download | a5e57e36…f4a501 |
| 0.6.3+1 | Cached · Upstream SHA-256 matched | Download | fba0cee1…596dc1 |
| 0.6.3+2 | Cached · Upstream SHA-256 matched | Download | 261a1872…9b72a5 |
| 0.6.3+3 | Cached · Upstream SHA-256 matched | Download | a0dc3e2e…daa80d |
| 0.6.3+4 | Cached · Upstream SHA-256 matched | Download | 26d6714c…3e8c9a |
| 0.6.3+5 | Cached · Upstream SHA-256 matched | Download | 85e45a6e…e61b28 |
| 0.7.0 | Cached · Upstream SHA-256 matched | Download | 511f6ced…df1e08 |
| 0.7.1 | Cached · Upstream SHA-256 matched | Download | e1a3868e…fa8e06 |
| 0.7.1+1 | Cached · Upstream SHA-256 matched | Download | e8635809…8b6691 |
| 0.8.0 | Cached · Upstream SHA-256 matched | Download | 270cc269…58d957 |
| 0.8.1 | Cached · Upstream SHA-256 matched | Download | e4f6c2dd…385b6c |
| 0.8.2 | Cached · Upstream SHA-256 matched | Download | af8fb9bf…1ec1d8 |
| 0.8.2+1 | Cached · Upstream SHA-256 matched | Download | 27eb06b2…733192 |
| 0.8.2+2 | Cached · Upstream SHA-256 matched | Download | 2d038075…c2b1b3 |
| 0.8.3+1 | Cached · Upstream SHA-256 matched | Download | b8ece876…e86179 |
| 0.9.0 | Cached · Upstream SHA-256 matched | Download | a0e99914…f05176 |
| 0.10.0 | Cached · Upstream SHA-256 matched | Download | 7ffd2c08…7cdcf2 |
| 0.10.1 | Cached · Upstream SHA-256 matched | Download | 20d23b04…ca4f06 |
| 0.10.2 | Cached · Upstream SHA-256 matched | Download | 7996ad01…53d9a1 |
| 0.11.0 | Cached · Upstream SHA-256 matched | Download | 98d9da96…afacdf |
| 0.12.0 | Cached · Upstream SHA-256 matched | Download | d033fe80…3e3a6b |
| 0.13.0 | Cached · Upstream SHA-256 matched | Download | 18c6280d…d37fec |
| 0.13.1 | Cached · Upstream SHA-256 matched | Download | 0a94c626…edd512 |
| 0.14.0 | Cached · Upstream SHA-256 matched | Download | 5fdd2cfc…a9ce71 |
| 0.14.0+1 | Cached · Upstream SHA-256 matched | Download | 9d30cde3…ae177f |
| 0.14.0+2 | Cached · Upstream SHA-256 matched | Download | a1e7dd1d…9939a1 |
| 0.15.0 | Cached · Upstream SHA-256 matched | Download | 1a25d2da…699ef1 |
| 0.15.1 | Cached · Upstream SHA-256 matched | Download | e4133253…4b0378 |
| 0.16.0 | Cached · Upstream SHA-256 matched | Download | 6b47d4ca…824efc |
| 0.16.0+1 | Cached · Upstream SHA-256 matched | Download | b53243a8…341ce9 |
| 0.16.0+2 | Cached · Upstream SHA-256 matched | Download | ae15fbca…5e47ea |
| 0.16.1 | Cached · Upstream SHA-256 matched | Download | 4c7c36b2…7e2678 |
| 0.16.2 | Cached · Upstream SHA-256 matched | Download | ce20f885…610bc2 |
| 0.16.3 | Cached · Upstream SHA-256 matched | Download | 47531cc1…ab9d30 |
| 0.16.4 | Cached · Upstream SHA-256 matched | Download | 1ec7cde3…6132ad |
| 0.16.5 | Cached · Upstream SHA-256 matched | Download | 3fee42bc…e41a28 |
| 0.16.6 | Cached · Upstream SHA-256 matched | Download | c71a72d4…62f1c3 |
| 0.16.7 | Cached · Upstream SHA-256 matched | Download | 4c2dedb2…aa84a6 |
| 0.17.0 | Cached · Upstream SHA-256 matched | Download | b0d6865d…24959b |
| 0.18.0 | Cached · Upstream SHA-256 matched | Download | 864a5f32…72ba2e |
| 0.18.1 | Cached · Upstream SHA-256 matched | Download | 8f4130f9…9f7e0d |
| 0.19.0 | Cached · Upstream SHA-256 matched | Download | 4097cc92…19e131 |
| 0.20.0 | Cached · Upstream SHA-256 matched | Download | 3f3b7a45…71ac6e |
| 0.21.0 | Cached · Upstream SHA-256 matched | Download | 18a5e310…d23bfb |
| 0.22.0 | Cached · Upstream SHA-256 matched | Download | 3b4c1c24…3a10c4 |
| 0.22.1 | Cached · Upstream SHA-256 matched | Download | c934cbbb…31acbe |
| 0.22.1+1 | Cached · Upstream SHA-256 matched | Download | a85b911a…432577 |
| 0.22.2 | Cached · Upstream SHA-256 matched | Download | d3e28dab…88bb1d |
| 0.22.3 | Cached · Upstream SHA-256 matched | Download | 87acf1eb…e1d3e5 |
| 0.22.4 | Cached · Upstream SHA-256 matched | Download | 916aa71a…a6c21d |
| 0.22.5 | Cached · Upstream SHA-256 matched | Download | 83c06171…276da5 |
| 0.22.6 | Cached · Upstream SHA-256 matched | Download | 79022a7d…2e1241 |
| 0.23.0-dev.1 | Cached · Upstream SHA-256 matched | Download | 0b03b203…8204de |
| 0.23.0-dev.2 | Cached · Upstream SHA-256 matched | Download | b2968d8b…265c98 |
| 0.23.0-dev.3 | Cached · Upstream SHA-256 matched | Download | 685f66f6…687e34 |
| 0.23.0 | Cached · Upstream SHA-256 matched | Download | 13455e1c…957209 |
| 0.23.1 | Cached · Upstream SHA-256 matched | Download | 4bae6903…f35d88 |
| 0.24.0-dev.1 | Cached · Upstream SHA-256 matched | Download | 11e59b31…f968a5 |
| 0.24.0 | Cached · Upstream SHA-256 matched | Download | 09b328f6…1f1a2e |
| 0.24.1 | Cached · Upstream SHA-256 matched | Download | 0beed421…2aa97e |
| 0.25.0-beta | Cached · Upstream SHA-256 matched | Download | eb1ac150…fb494d |
| 0.25.0-beta2 | Cached · Upstream SHA-256 matched | Download | 6a055724…e5ae99 |
| 0.25.0-beta3 | Cached · Upstream SHA-256 matched | Download | fb4eb6f4…aa37a5 |
| 0.25.0 | Cached · Upstream SHA-256 matched | Download | c7cd7cee…d9e3c3 |
| 0.26.0-nullsafety.0 | Cached · Upstream SHA-256 matched | Download | 540ef29a…48159c |
| 0.26.0-nullsafety.1 | Cached · Upstream SHA-256 matched | Download | ee3719e8…8415fe |
| 0.26.0 | Cached · Upstream SHA-256 matched | Download | 2ef8b4e9…cc21fd |
| 0.27.0 | Cached · Upstream SHA-256 matched | Download | 3f7cb435…091f90 |
| 0.27.1 | Cached · Upstream SHA-256 matched | Download | e59cd262…e853d9 |
| 0.27.2 | Cached · Upstream SHA-256 matched | Download | 7358d9e1…e3d5d6 |
| 0.27.3 | Cached · Upstream SHA-256 matched | Download | bc2d2b17…39c46d |
| 0.27.4 | Cached · Upstream SHA-256 matched | Download | 933db292…2888cb |
| 0.27.5 | Cached · Upstream SHA-256 matched | Download | 5d22055f…b0209c |
| 0.27.6 | Cached · Upstream SHA-256 matched | Download | 46383ce2…1952bf |
| 0.27.7 | Cached · Upstream SHA-256 matched | Download | 0c7c0ced…0044cb |
| 0.28.0-dev.0 | Cached · Upstream SHA-256 matched | Download | 93bca4fe…c82cdf |
| 0.28.0-dev.1 | Cached · Upstream SHA-256 matched | Download | 5a11abd6…6be690 |
| 0.28.0-dev.2 | Cached · Upstream SHA-256 matched | Download | e5507e36…378d3c |
| 0.28.0 | Cached · Upstream SHA-256 matched | Download | 5c3004a4…d1a962 |
Dependencies
No direct dependencies declared.