class MyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Defaul
You could use broadcast
, which allows to listen stream more than once, but it also prevents from listening past events:
Broadcast streams do not buffer events when there is no listener.
A better option is to use BehaviorSubject
from rxdart
package class as StreamController
. BehaviorSubject
is:
A special StreamController that captures the latest item that has been added to the controller, and emits that as the first item to any new listener.
The usage is as simple as:
StreamController<...> _controller = BehaviorSubject();