Using a stream builder with its stream set to a BehaviourSubject's stream, whenever the parent widget is rebuilt and the builder function of the streamBuilder is invoked, the snapshot connection state is waiting ,and despite having previous data in the stream the snapshot has no data.. Then immediately the builder is invoked again with active connection and the snapshot has latest value..
Shouldn't the latest value in the BehaviourSubject's stream be accessible in the first time ?
No, the stream values are always asynchronous so StreamBuilder
always passes through a waiting state. You can mitigate this behavior by setting its initialData
to the stream's value
property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With