readValue method

Future<ByteData> readValue()

Will read the value of the characteristic. The value read will be returned and also set as the value property.

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

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

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

  • May throw InvalidStateError if characteristic is null

See:

Implementation

Future<ByteData> readValue() async {
  final promise = _JSUtil.callMethod(_jsObject, "readValue", []);
  final result = await _JSUtil.promiseToFuture(promise);
  final data = WebBluetoothConverters.convertJSDataViewToByteData(result);
  return data;
}