I am writing a periodic stream with duration of 1 second to show time:
stream: Stream.periodic(Duration(seconds: 1)),
builder: (context, snapshot) {
return Text(DateTime.now().toString());
}
Also, I can achieve the same with:
Stream.periodic(Duration(seconds: 1)).listen((){
setState(){});
as well.
I wonder, which approach is more efficient?
Stream builder returning a single widget or in other cases a widget tree every second. While setState() rebuild whole app widget tree in my case. I am confused here. Please advise.