writeValue method

  1. @Deprecated("This method is technically deprecated in the Web Bluetooth spec, " "but not every browser supports the new `writeValueWithResponse` " "and `writeValueWithoutResponse` yet.")
Future<void> writeValue(
  1. Uint8List value
)

Will write a new value to the characteristic.

This will not update the WebBluetoothRemoteGATTCharacteristic.value property.

This method is deprecated, but the replacements writeValueWithoutResponse, and writeValueWithResponse may not be implemented the browser.

  • May throw NotSupportedError if the operation is not allowed. Check properties to see if it is supported.

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

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

  • May throw InvalidStateError if characteristic is null

See:

Implementation

@Deprecated(
    "This method is technically deprecated in the Web Bluetooth spec, "
    "but not every browser supports the new `writeValueWithResponse` "
    "and `writeValueWithoutResponse` yet.")
Future<void> writeValue(final Uint8List value) async {
  final data = WebBluetoothConverters.convertUint8ListToJSArrayBuffer(value);
  final promise = _JSUtil.callMethod(_jsObject, "writeValue", [data]);
  await _JSUtil.promiseToFuture(promise);
}