You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue only appears in widget test environment ('testWidgets').
If widget utilize the 'stream.first' within itself or bloc, not really matters,
and stream is BehaviorSubject, the Future provided by 'first' never finishes.
Example
The widget in the example below just shows text 'Value = $number'
with the number from assigned stream.
In the real environment the last added value to the stream is shown on the screen.
But in the test we see 'Value = -1' because timeout fires.
Without timeout widget never receives any value.
The dartpad example:
https://dartpad.dev/?id=02878d4135fdf329059f95fb9f7a72c4
Description
The issue only appears in widget test environment ('testWidgets').
If widget utilize the 'stream.first' within itself or bloc, not really matters,
and stream is BehaviorSubject, the Future provided by 'first' never finishes.
Example
The widget in the example below just shows text 'Value = $number'
with the number from assigned stream.
In the real environment the last added value to the stream is shown on the screen.
But in the test we see 'Value = -1' because timeout fires.
Without timeout widget never receives any value.
Note
According to this issue, if we wrap pumpWidget within runAsync, it actually works.
However, it doesn't feel right. It is more like a workaround.
The question is, can this issue be resolved?
If not, or if you believe this is not an issue, could you clarify why such behavior is legit.
Thanks in advance.
The text was updated successfully, but these errors were encountered: