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 only verified this behaviour on Android. But what happens is if there are two listeners to FlutterBlue.state and one cancels its subscription, it appears to cancel every stream. I did some digging and it appears that flutter blue generates a new broadcast stream that listens to the native level per listener that subscribes, which when a single stream closes it then sends the cancel command to the native level.
final fb =FlutterBlue.instance;
var sub1 = fb.state.listen (doStuff);
var sub2 = fb.state.listen(doOtherStuff);
sub1.cancel();
// sub2 will no longer receive events now
Fix bug where if there were multiple subscribers to FlutterBlue.state
and one cancelled it would accidentally cancel all subscribers
Fix for: pauldemarco#608
I have only verified this behaviour on Android. But what happens is if there are two listeners to FlutterBlue.state and one cancels its subscription, it appears to cancel every stream. I did some digging and it appears that flutter blue generates a new broadcast stream that listens to the native level per listener that subscribes, which when a single stream closes it then sends the cancel command to the native level.
Code of interest:
Android Native StateStream Handler
Dart Implementation of
FlutterBlue.state
The text was updated successfully, but these errors were encountered: