flutter_reactive_ble
                                
                                
                                
                                    flutter_reactive_ble copied to clipboard
                            
                            
                            
                        scanForDevices in statusStream causes an error
Describe the bug I tried to nest the scanForDevices method inside the statusStream in order to only scan for the devices when the ble status is ready
ble.statusStream.listen((BleStatus status) {
      if (status == BleStatus.ready) {
        ble.scanForDevices(withServices: []).listen((event) {});
      }
 });
By doing this, I received the following error:
reactive_ble_mobile/PluginController.swift:158: Assertion failed
reactive_ble_mobile/PluginController.swift:158: Assertion failed
* thread #1, queue = 'com.apple.main-thread', stop reason = Assertion failed
    frame #0: 0x00000001cbe390f8 libswiftCore.dylib`_swift_runtime_on_report
libswiftCore.dylib`:
->  0x1cbe390f8 <+0>: ret    
libswiftCore.dylib`:
    0x1cbe390fc <+0>: b      0x1cbe390f8               ; _swift_runtime_on_report
libswiftCore.dylib`:
    0x1cbe39100 <+0>: adrp   x8, 365868
    0x1cbe39104 <+4>: ldrb   w0, [x8, #0xabc]
Target 0: (Runner) stopped.
                                    
                                    
                                    
                                
I found the same crash just by starting two scans at the same time. The failing assertion is assert(!central.isScanning).
This is the same issue described in https://github.com/PhilipsHue/flutter_reactive_ble/issues/221 and https://github.com/PhilipsHue/flutter_reactive_ble/issues/283.