What are the key differences between between the Dart Streams API (with rxdart) and other reactive libraries such as RxJava and RxJS?
Asked Answered
A

1

6

Right now I'm trying to port the logic of an existing reactive Angular application (RxJS-based) to Flutter. I'm facing a lot of problems with the dart streams API, which seems to behave quite differently than other Rx implementations.

What are the key differences in regards to:

  • error and completion events
  • null/void value handling
  • stream reusability
  • multicast (publish, refcount, shareReplay)
  • subscription management

?

Asyllabic answered 29/6, 2018 at 7:33 Comment(5)
This question is way too broad for StackOverflow. StackOverflow is for concrete programming questions. This question properly answered probably becomes an essay with 30 pages.Palaeobotany
The difference between rxdart and rxjs is written directly on rxdart ReadmeSinghalese
@RémiRousselet I'm unable to find a list of differences or even the word "rxjs" in the README of rxdartAsyllabic
github.com/ReactiveX/rxdart#observableSinghalese
If you have a specific scenario that's failing and it's not clear why, please consider writing a minimal reproducible exampleVaporous
Y
6

From Rx Observables vs Dart Streams :

In many situations, Streams and Observables work the same way. However, if you're used to standard Rx Observables, some features of the Stream api may surprise you. We've included a table below to help folks understand the differences.

Additional information about the following situations can be found by reading the Rx class documentation.

┌────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┬───────────────────────────────────────┐
│                 Situation                  │                                                   Rx Observables                                                    │             Dart Streams              │
├────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┼───────────────────────────────────────┤
│ An error is raised                         │ Observable Terminates with Error                                                                                    │ Error is emitted and Stream continues │
│ Cold Observables                           │ Multiple subscribers can listen to the same cold Observable, each subscription will receive a unique Stream of data │ Single subscriber only                │
│ Hot Observables                            │ Yes                                                                                                                 │ Yes, known as Broadcast Streams       │
│ Is {Publish, Behavior, Replay}Subject hot? │ Yes                                                                                                                 │ Yes                                   │
│ Single/Maybe/Complete ?                    │ Yes                                                                                                                 │ No, uses Dart Future                  │
│ Support back pressure                      │ Yes                                                                                                                 │ Yes                                   │
│ Can emit null?                             │ Yes, except RxJava                                                                                                  │ Yes                                   │
│ Sync by default                            │ Yes                                                                                                                 │ No                                    │
│ Can pause/resume a subscription*?          │ No                                                                                                                  │ Yes                                   │
└────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────────────────────────┘
Yl answered 15/10, 2020 at 19:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.