To my basic understanding of Stream
and sink
we add data to sink in order to pass it through the stream but to add it we use a getter instead of setter, which I find counter-intuitive (see example below), could you please explain in simple words why is it how it is and not the other way around?
Example:
class BlogPostViewModel {
StreamController<List<BlogPost>> _blogPostListController = StreamController.broadcast();
Stream<List<BlogPost>> get outBlogPostList => _blogPostListController.stream;
Sink<List<BlogPost>> get _inBlogPostList => _blogPostListController.sink; // Here why use get and not a setter?
}
In advance, thank you.