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
I have a function foo that returns a Stream
I have a function onClick that cancels the previous StreamSubscription, calls foo, and adds a new listener
class bar {
StreamSubscription? _streamSubscription;
Steam foo () {
...
}
void onClick () {
await _streamSubscription?.cancel();
var stream = foo();
_streamSubscription = stream.listen((element) { print(element) })
}
}
from my understanding because of the await _streamSubscription?.cancel(); the user can run multiple times onClick and create a race condition, not all _streamSubscription is sure to be canceled
The text was updated successfully, but these errors were encountered:
I have a function
foo
that returns aStream
I have a function
onClick
that cancels the previous StreamSubscription, callsfoo
, and adds a new listenerfrom my understanding because of the
await _streamSubscription?.cancel();
the user can run multiple timesonClick
and create a race condition, not all_streamSubscription
is sure to be canceledThe text was updated successfully, but these errors were encountered: