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

Read response from Flutter Bluetooth device

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

I am using Flutter Blue to write to device (tx in this case), which automatically sends back a response with List on the tx pin (rx in this case). How do I read the response? I'm getting value always as null. The device will send multiple packets of 20 bytes length.

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

I also tried:

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

Flutter Blue has problems with maintenance. I've opted for Flutter_Reactive_Ble which is supported by developers from Phillips and is very stable. This error does not happen there.

Would recommend anyone who navigated here to do the same.