Viewing version 0.8.3+1. Open the latest package page.

rxdart

0.8.3+1

Native Dart rx implementation

Download archive

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:

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

VersionPublishedArchiveSHA-256
0.1.0Cached · Upstream SHA-256 matchedDownload7b2c6e72…523c15
0.1.0+1Cached · Upstream SHA-256 matchedDownloadd3b2922d…679f2a
0.1.0+2Cached · Upstream SHA-256 matchedDownloadedfa980c…d43a9b
0.1.0+3Cached · Upstream SHA-256 matchedDownloaddc82051d…0285ab
0.1.0+4Cached · Upstream SHA-256 matchedDownload39c33b63…bb88ce
0.1.0+5Cached · Upstream SHA-256 matchedDownloadb2e90d5e…96e23e
0.1.0+6Cached · Upstream SHA-256 matchedDownloade417d502…bb148e
0.2.0Cached · Upstream SHA-256 matchedDownload4fdc3a49…725854
0.2.0+1Cached · Upstream SHA-256 matchedDownload71d9f48f…f3879d
0.2.0+3Cached · Upstream SHA-256 matchedDownloadb7742d6d…daea85
0.3.0Cached · Upstream SHA-256 matchedDownload7eeca94a…2df1ed
0.3.1Cached · Upstream SHA-256 matchedDownloadfc0a390f…3415e3
0.3.2Cached · Upstream SHA-256 matchedDownload353a7970…100d09
0.3.3Cached · Upstream SHA-256 matchedDownload9276f3f4…23c6d5
0.3.4Cached · Upstream SHA-256 matchedDownload3fa075ce…7b5512
0.3.5Cached · Upstream SHA-256 matchedDownloadc6a63b6f…0bdb0b
0.3.6Cached · Upstream SHA-256 matchedDownload9695e85a…ae84a5
0.3.7Cached · Upstream SHA-256 matchedDownload5eb73e19…e1ba1a
0.3.8Cached · Upstream SHA-256 matchedDownload491112d8…41339d
0.3.8+1Cached · Upstream SHA-256 matchedDownload6e7b0d49…ce7b24
0.3.9Cached · Upstream SHA-256 matchedDownloadf3660828…9c9ecc
0.3.10Cached · Upstream SHA-256 matchedDownloadf2fa34eb…e31b70
0.3.11Cached · Upstream SHA-256 matchedDownloadb5c4093d…f1c0a8
0.3.12Cached · Upstream SHA-256 matchedDownloadefb6bc41…3ec0c3
0.3.13Cached · Upstream SHA-256 matchedDownloadb606e2b9…a97fdd
0.3.14Cached · Upstream SHA-256 matchedDownloaddd3a48de…129a13
0.3.15Cached · Upstream SHA-256 matchedDownload14cac08f…61d366
0.3.16Cached · Upstream SHA-256 matchedDownload45c18814…d6fd01
0.3.17Cached · Upstream SHA-256 matchedDownload472670ab…5b128b
0.3.18Cached · Upstream SHA-256 matchedDownload003af73f…e496cc
0.3.19Cached · Upstream SHA-256 matchedDownload83ea5ffd…0b8779
0.3.20Cached · Upstream SHA-256 matchedDownloadde431744…2ac9ab
0.3.21Cached · Upstream SHA-256 matchedDownload17c84b88…99609b
0.3.22Cached · Upstream SHA-256 matchedDownload5cb985a3…2e939a
0.3.24Cached · Upstream SHA-256 matchedDownload6baac2a7…c4ef60
0.3.25Cached · Upstream SHA-256 matchedDownload55b1b751…3d371f
0.4.0Cached · Upstream SHA-256 matchedDownloadf16b4c82…f1b045
0.4.1Cached · Upstream SHA-256 matchedDownloada78d65a3…b204ec
0.4.2Cached · Upstream SHA-256 matchedDownloadbff12d4e…331493
0.4.3Cached · Upstream SHA-256 matchedDownload95e65662…cbb822
0.4.4Cached · Upstream SHA-256 matchedDownload839ac5b0…c194d5
0.4.5Cached · Upstream SHA-256 matchedDownloada104543d…2fce1d
0.4.6Cached · Upstream SHA-256 matchedDownload9a272d97…292d0d
0.4.7Cached · Upstream SHA-256 matchedDownloadd62c6d02…a7a464
0.4.8Cached · Upstream SHA-256 matchedDownloadb6df4602…5f5e1f
0.5.0Cached · Upstream SHA-256 matchedDownloadaf8cbcbd…8167a7
0.5.1Cached · Upstream SHA-256 matchedDownloadc3c1a58f…2c9691
0.6.0Cached · Upstream SHA-256 matchedDownloadc4ebe9fd…55994a
0.6.1Cached · Upstream SHA-256 matchedDownload59e032b1…a36028
0.6.1+1Cached · Upstream SHA-256 matchedDownload8d218fbb…48c0b2
0.6.1+2Cached · Upstream SHA-256 matchedDownloade660f25c…01610f
0.6.2Cached · Upstream SHA-256 matchedDownload245a4d94…e2d7d9
0.6.2+1Cached · Upstream SHA-256 matchedDownload06bd3411…0436d4
0.6.3Cached · Upstream SHA-256 matchedDownloada5e57e36…f4a501
0.6.3+1Cached · Upstream SHA-256 matchedDownloadfba0cee1…596dc1
0.6.3+2Cached · Upstream SHA-256 matchedDownload261a1872…9b72a5
0.6.3+3Cached · Upstream SHA-256 matchedDownloada0dc3e2e…daa80d
0.6.3+4Cached · Upstream SHA-256 matchedDownload26d6714c…3e8c9a
0.6.3+5Cached · Upstream SHA-256 matchedDownload85e45a6e…e61b28
0.7.0Cached · Upstream SHA-256 matchedDownload511f6ced…df1e08
0.7.1Cached · Upstream SHA-256 matchedDownloade1a3868e…fa8e06
0.7.1+1Cached · Upstream SHA-256 matchedDownloade8635809…8b6691
0.8.0Cached · Upstream SHA-256 matchedDownload270cc269…58d957
0.8.1Cached · Upstream SHA-256 matchedDownloade4f6c2dd…385b6c
0.8.2Cached · Upstream SHA-256 matchedDownloadaf8fb9bf…1ec1d8
0.8.2+1Cached · Upstream SHA-256 matchedDownload27eb06b2…733192
0.8.2+2Cached · Upstream SHA-256 matchedDownload2d038075…c2b1b3
0.8.3+1Cached · Upstream SHA-256 matchedDownloadb8ece876…e86179
0.9.0Cached · Upstream SHA-256 matchedDownloada0e99914…f05176
0.10.0Cached · Upstream SHA-256 matchedDownload7ffd2c08…7cdcf2
0.10.1Cached · Upstream SHA-256 matchedDownload20d23b04…ca4f06
0.10.2Cached · Upstream SHA-256 matchedDownload7996ad01…53d9a1
0.11.0Cached · Upstream SHA-256 matchedDownload98d9da96…afacdf
0.12.0Cached · Upstream SHA-256 matchedDownloadd033fe80…3e3a6b
0.13.0Cached · Upstream SHA-256 matchedDownload18c6280d…d37fec
0.13.1Cached · Upstream SHA-256 matchedDownload0a94c626…edd512
0.14.0Cached · Upstream SHA-256 matchedDownload5fdd2cfc…a9ce71
0.14.0+1Cached · Upstream SHA-256 matchedDownload9d30cde3…ae177f
0.14.0+2Cached · Upstream SHA-256 matchedDownloada1e7dd1d…9939a1
0.15.0Cached · Upstream SHA-256 matchedDownload1a25d2da…699ef1
0.15.1Cached · Upstream SHA-256 matchedDownloade4133253…4b0378
0.16.0Cached · Upstream SHA-256 matchedDownload6b47d4ca…824efc
0.16.0+1Cached · Upstream SHA-256 matchedDownloadb53243a8…341ce9
0.16.0+2Cached · Upstream SHA-256 matchedDownloadae15fbca…5e47ea
0.16.1Cached · Upstream SHA-256 matchedDownload4c7c36b2…7e2678
0.16.2Cached · Upstream SHA-256 matchedDownloadce20f885…610bc2
0.16.3Cached · Upstream SHA-256 matchedDownload47531cc1…ab9d30
0.16.4Cached · Upstream SHA-256 matchedDownload1ec7cde3…6132ad
0.16.5Cached · Upstream SHA-256 matchedDownload3fee42bc…e41a28
0.16.6Cached · Upstream SHA-256 matchedDownloadc71a72d4…62f1c3
0.16.7Cached · Upstream SHA-256 matchedDownload4c2dedb2…aa84a6
0.17.0Cached · Upstream SHA-256 matchedDownloadb0d6865d…24959b
0.18.0Cached · Upstream SHA-256 matchedDownload864a5f32…72ba2e
0.18.1Cached · Upstream SHA-256 matchedDownload8f4130f9…9f7e0d
0.19.0Cached · Upstream SHA-256 matchedDownload4097cc92…19e131
0.20.0Cached · Upstream SHA-256 matchedDownload3f3b7a45…71ac6e
0.21.0Cached · Upstream SHA-256 matchedDownload18a5e310…d23bfb
0.22.0Cached · Upstream SHA-256 matchedDownload3b4c1c24…3a10c4
0.22.1Cached · Upstream SHA-256 matchedDownloadc934cbbb…31acbe
0.22.1+1Cached · Upstream SHA-256 matchedDownloada85b911a…432577
0.22.2Cached · Upstream SHA-256 matchedDownloadd3e28dab…88bb1d
0.22.3Cached · Upstream SHA-256 matchedDownload87acf1eb…e1d3e5
0.22.4Cached · Upstream SHA-256 matchedDownload916aa71a…a6c21d
0.22.5Cached · Upstream SHA-256 matchedDownload83c06171…276da5
0.22.6Cached · Upstream SHA-256 matchedDownload79022a7d…2e1241
0.23.0-dev.1Cached · Upstream SHA-256 matchedDownload0b03b203…8204de
0.23.0-dev.2Cached · Upstream SHA-256 matchedDownloadb2968d8b…265c98
0.23.0-dev.3Cached · Upstream SHA-256 matchedDownload685f66f6…687e34
0.23.0Cached · Upstream SHA-256 matchedDownload13455e1c…957209
0.23.1Cached · Upstream SHA-256 matchedDownload4bae6903…f35d88
0.24.0-dev.1Cached · Upstream SHA-256 matchedDownload11e59b31…f968a5
0.24.0Cached · Upstream SHA-256 matchedDownload09b328f6…1f1a2e
0.24.1Cached · Upstream SHA-256 matchedDownload0beed421…2aa97e
0.25.0-betaCached · Upstream SHA-256 matchedDownloadeb1ac150…fb494d
0.25.0-beta2Cached · Upstream SHA-256 matchedDownload6a055724…e5ae99
0.25.0-beta3Cached · Upstream SHA-256 matchedDownloadfb4eb6f4…aa37a5
0.25.0Cached · Upstream SHA-256 matchedDownloadc7cd7cee…d9e3c3
0.26.0-nullsafety.0Cached · Upstream SHA-256 matchedDownload540ef29a…48159c
0.26.0-nullsafety.1Cached · Upstream SHA-256 matchedDownloadee3719e8…8415fe
0.26.0Cached · Upstream SHA-256 matchedDownload2ef8b4e9…cc21fd
0.27.0Cached · Upstream SHA-256 matchedDownload3f7cb435…091f90
0.27.1Cached · Upstream SHA-256 matchedDownloade59cd262…e853d9
0.27.2Cached · Upstream SHA-256 matchedDownload7358d9e1…e3d5d6
0.27.3Cached · Upstream SHA-256 matchedDownloadbc2d2b17…39c46d
0.27.4Cached · Upstream SHA-256 matchedDownload933db292…2888cb
0.27.5Cached · Upstream SHA-256 matchedDownload5d22055f…b0209c
0.27.6Cached · Upstream SHA-256 matchedDownload46383ce2…1952bf
0.27.7Cached · Upstream SHA-256 matchedDownload0c7c0ced…0044cb
0.28.0-dev.0Cached · Upstream SHA-256 matchedDownload93bca4fe…c82cdf
0.28.0-dev.1Cached · Upstream SHA-256 matchedDownload5a11abd6…6be690
0.28.0-dev.2Cached · Upstream SHA-256 matchedDownloade5507e36…378d3c
0.28.0Cached · Upstream SHA-256 matchedDownload5c3004a4…d1a962

Dependencies

No direct dependencies declared.