flutter_blue
flutter_blue copied to clipboard
Fixing problem when canceling the scan subscription.
When canceling a scan
subscription, the scanner is not stopped. This causes a second scan to fail. When calling stopScan
on doOnCancel
, it works as expected and stoppes the scan.
Due to the documentation of this method they're covering 2 different scenarios. https://pub.dev/documentation/rxdart/latest/rx/Observable/doOnDone.html https://pub.dev/documentation/rxdart/latest/rx/Observable/doOnCancel.html
If you take the doOnDone example, subscribe to it and cancel the subscription, the text won't be shown. this is the reason why for the scan
method both options should lead to stopScan