I have Bluetooth classic device and I have used bluetooth_classic package and succeeded on getting the device in scan.
but I am not able to stop the subscription which I started during scanning process.
and getting this error when I stop the scan and then again starting the scan second time: Stream has already been listened to.
late StreamSubscription<Device> _scanResultsSubscription;
_scanResultsSubscription = _bluetoothClassicPlugin.onDeviceDiscovered().listen(
(event) {
_discoveredDevices = [..._discoveredDevices, event];
},
);
@override
void dispose() {
_scanResultsSubscription.cancel();
super.dispose();
}