Closed ringonotts closed 10 months ago
I don't think I can answer this for you with the code given.
But you can check FlutterBluePlus.isScanningNow
to make sure you do not call it twice.
Thanks Chip for getting back to me. Actually you were a great help!
FlutterBluePlus Version
1.14.11
Flutter Version
3.10.1
What OS?
Android
OS Version
13
Ask your question
I am migrating my application from flutter_blue and have the following code for scanning:
I perform the scan and am getting an exception 'another scan already in progress' from flutter_blue_plus.dart line 148.
When i set a breakpoint on line 146 I can see I hit this scan() method twice. The first time I hit the method _isScanning.value == false, and there is a call stack to where i called the scan function. The second time I hit the breakpoint (note _scanListenHandler() has not been called) _isScanning.value == true and there is no call stack - just a "asyncronous gap". Obviously it's this second call to scan() causing the exception.
Why is the scan() method called twice ? Am i calling it correctly ? Note I need to know when the scan is complete so i can stop the circular progress indicator in my app (hence not using startScan()).
Thanks in advance, Ringo
Logs