最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

dart - Bluetooth package for Bluetooth classic devices in flutter - Stack Overflow

programmeradmin1浏览0评论

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();
  }

发布评论

评论列表(0)

  1. 暂无评论