sgon00
sgon00

Reputation: 5817

Are there any relationships btw `BehaviorSubject` and `Sink`? and `StreamController`?

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.

Upvotes: 3

Views: 1233

Answers (1)

Saed Nabil
Saed Nabil

Reputation: 6871

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 :)

Upvotes: 10

Related Questions