Warm tip: This article is reproduced from serverfault.com, please click

dart-从Flutter蓝牙设备读取响应

(dart - Read response from Flutter Bluetooth device)

发布于 2020-11-29 15:33:25

我正在使用Flutter Blue写入设备(在这种情况下为tx),设备会自动发送回带有tx引脚上的List的响应(在这种情况下为rx)。我如何阅读回复?我一直在将价值视为null。设备将发送多个20个字节长度的数据包。

getBackgroundFunction() async {
    await _tx.write(setSetting, withoutResponse: false);
    List<int> value = await _rx.read();
    print(value);
  }

我也尝试过:

getBackgroundFunction() async {
    List<int> value = await _tx.write(setSetting, withoutResponse: false);
    print(value);
  }
Questioner
In-Vader
Viewed
11
In-Vader 2021-02-18 04:23:22

Flutter Blue在维护方面存在问题。我选择了Flutter_Reactive_Ble,它得到了Phillips开发人员的支持,并且非常稳定。在那里不会发生此错误。

会推荐任何在这里导航的人做同样的事情。