This library uses the new Dart-Js interop available as of SDK 1.13.0
The RxJs library is wrapped and exposed via the Observable Dart class:
List<int> codes = <int>[ 38, // up 38, // up 40, // down 40, // down 37, // left 39, // right 37, // left 39, // right 66, // b 65 // a ]; Element result = querySelector('#result'); new Rx.Observable<KeyboardEvent>.fromEvent(document.body, 'keyup') .map((KeyboardEvent e) => e.keyCode ) // get the key code .bufferWithCount(10, 1) // get the last 10 keys .filter((List<int> x) => _equal(x, codes)) // where we match .subscribe((_) => result.innerHtml = 'KONAMI!');
Use this package as a library
1. Depend on it
Add this to your package's pubspec.yaml file:
dependencies: rxdart: ^0.2.0
2. Install it
You can install packages from the command line:
$ pub get
Alternatively, your editor might support
Check the docs for your editor to learn more.
3. Import it
Now in your Dart code, you can use:
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
This package version is not analyzed, because it is more than two years old. Check the latest stable version for its analysis.
The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.
Analysis issues and suggestions
Support Dart 2 in
The SDK constraint in
pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://dart.cn/dart-2#migration.