writeValue method

Future<void> writeValue(
  1. Uint8List value
)

Will write a new value to the characteristic.

This will not update the WebBluetoothRemoteGATTCharacteristic.value property.

  • May throw SecurityError if the characteristic is blocked form writing using a blocklist.

  • May throw InvalidModificationError if value is more than 512 bytes long.

  • May throw NetworkError if the GATT server is not connected.

  • May throw InvalidStateError if descriptor is null

See:

Implementation

Future<void> writeValue(final Uint8List value) async {
  final data = WebBluetoothConverters.convertUint8ListToJSArrayBuffer(value);
  final promise = _JSUtil.callMethod(_jsObject, "writeValue", [data]);
  await _JSUtil.promiseToFuture(promise);
}