Why use InheritedWidget while we can use Broadcast Streams | StreamBuilder and Static Variables [closed]

大憨熊 提交于 2019-12-09 23:58:05

问题


Why use InheritedWidget while we can use Broadcast Streams | StreamBuilder and Static Variables?

Why should we bother about redux, scoped model, etc. while we can have a simple and clean architecture?


回答1:


Streams/Sink definitely are excellent to store a state. There are some existing architectures, such as BLoC which uses them a lot.

But, Streams don't entirely replace InheritedWidget either. InheritedWidget comes with the cool ability to override it's content for only a part of the screen. One cool application of this is Theme.

Generally speaking, Streams are cool to store business logic. But when you need to store UI logic, InheritedWidgets takes the upper hand.



来源:https://stackoverflow.com/questions/49958266/why-use-inheritedwidget-while-we-can-use-broadcast-streams-streambuilder-and-s

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!