翩翩起舞--写入特性错误
我无法在出血性设备上写入,使用
flutter_blue
库,它抛出了这个异常。
Unhandled Exception: PlatformException(write_characteristic_error, service (0000ff06-0000-1000-8000-00805f9b34fb) could not be located on the device, null, null)
E/flutter (29808): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
E/flutter (29808): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
E/flutter (29808): <asynchronous suspension>
E/flutter (29808): #2 BluetoothCharacteristic.write (package:flutter_blue/src/bluetooth_characteristic.dart:120:18)
E/flutter (29808): <asynchronous suspension>
E/flutter (29808): #3 DeviceScreen._buildServiceTiles.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:untitled/main.dart:176:23)
或者另一个错误说:Write is not permited。
我正在使用flutter blue库提供的示例代码,以下是我在设备连接后试图写入的代码。
onWritePressed: () async {
await c.write(_getRandomBytes(), withoutResponse: true);
await c.read();
onNotificationPressed: () async {
await c.setNotifyValue(!c.isNotifying);
if (c.properties.read) {
await c.read();
List<int> _getRandomBytes(){