Reputation: 2281
I have a static StreamController.
static StreamController<OrgSetting> setting = StreamController.broadcast();
void updateSetting(OrgSetting newSetting){
setting.add(newSetting);
}
I have a page that uses the above streamController to display some value inside a listView.
StreamBuilder(stream : MyInfo.setting.stream, builder : (context, snapshot) {
if(snapShot.hasData){
return someView();
}else {
return defaultView();
}
}
When I add a data to the streamController before I get into this ListView, it always says that the snapShot.hasData is false. When I add a data to the streamController after I get into this ListView, it works as I intented.
Is there some concept I'm missing about the streamController? Why is this happening?
Upvotes: 0
Views: 36