Are there any relationships btw `BehaviorSubject`

2019-05-30 03:55发布

问题:

By reading @abin's answer in What is the difference between Sink and Stream in Flutter?, I have understood the relation btw Sink and Stream. Other than that, What are the relationships btw BehaviorSubject, BehaviorSubject.add, StreamController, BehaviorSubject.stream or maybe with Sink? I have no idea if there are any relationships btw BehaviorSubject and Sink. Maybe these two have no relationship at all? In the Google I/O 2018 video, it basically just uses BehaviorSubject.add and BehaviorSubject.stream for the output. Thanks.

回答1:

StreamController has a Stream and a Sink

BehaviorSubject is a type of StreamController that can remember the last value added to its sink

BehaviorSubject is a class from RxDart a member of reactive libraries implemented for Dart language.

Sink is where you dump your object into Stream.

hope that help you :)



标签: dart flutter