RxDart is a ReactiveX implementation for Dart that extends native Dart Streams (not replacing them). Monorepo managed by Melos with two published packages and examples.
packages/rxdart— Core library. Zero runtime dependencies. Three pillars:- Stream classes (
lib/src/streams/) — ExtendStreamView<R>, wrap aStreamController. E.g.,CombineLatestStream,MergeStream. - Transformers (
lib/src/transformers/) — ImplementStreamTransformer, exposed asextensionmethods onStream. UseForwardingSink/forwardStreampattern fromlib/src/utils/. - Subjects (
lib/src/subjects/) — Extend abstractSubject<T>(which extendsStreamView<T>implementsStreamController<T>). Three types:BehaviorSubject,PublishSubject,ReplaySubject.
- Stream classes (
Rxclass (lib/src/rx.dart) — Static factory facade for all stream constructors (e.g.,Rx.merge(...),Rx.combineLatest(...)).ValueStream<T>(lib/src/streams/value_stream.dart) — Key abstraction providing synchronous access to last emitted value. Used byBehaviorSubjectandrxdart_flutterwidgets.packages/rxdart_flutter— Flutter widgets (ValueStreamBuilder,ValueStreamListener,ValueStreamConsumer) that consumeValueStreams. Depends onrxdart.examples/— Fibonacci (CLI), Flutter GitHub search, and web examples. Not published (private packages).
# Bootstrap all packages (install deps, link local packages)
melos bootstrap
# Run all rxdart tests (single entry point — see below)
melos run test-rxdart
# Run rxdart_flutter tests
melos run test-rxdart-flutter
# Analyze (public packages only)
melos run analyze-no-private
# Format check
melos run format-no-private
# Code generation (packages using build_runner)
melos run generate- All rxdart tests are aggregated in
packages/rxdart/test/rxdart_test.dart— it imports every individual test file and calls eachmain(). When adding a new test, you must import it here and add themain()call. - Individual test files live in
test/streams/,test/subject/,test/transformers/,test/utils/, mirroringlib/src/. - Tests use
package:testwith stream matchers (emitsInOrder,emitsError,emitsDone). rxdart_fluttertests are inpackages/rxdart_flutter/test/src/usingflutter_test.
- Create class extending
Streaminlib/src/streams/. - Export from
lib/streams.dart. - Add a static factory to the
Rxclass inlib/src/rx.dart. - Add test in
test/streams/and register intest/rxdart_test.dart. - Enforce single-subscription contract if not broadcast; ensure stream closes properly.
- Create a
StreamTransformerclass inlib/src/transformers/usingForwardingSink+forwardStream(). - Add an
extensionmethod onStream<T>in the same file. - Export from
lib/transformers.dart. - Add test in
test/transformers/and register intest/rxdart_test.dart.
public_member_api_docslint is enforced — every public member needs doc comments with///.- Strict analysis:
strict-casts,strict-raw-types,strict-inferenceare all enabled. - Use single quotes for strings (
prefer_single_quotes). - Format with
dart format. - Internal utilities live in
lib/src/utils/(not exported publicly). Key ones:ForwardingSink,ForwardingStream,CompositeSubscription,ErrorAndStackTrace. - Barrel exports:
rxdart.dartre-exportsstreams.dart,subjects.dart,transformers.dart,utils.dart. Keep these in sync when adding new files.