writeCharacteristicWithResponse method

Future<void> writeCharacteristicWithResponse(
  1. QualifiedCharacteristic characteristic, {
  2. required List<int> value,
})

Writes a value to the specified characteristic awaiting for an acknowledgement.

The returned future completes with an error in case of a failure during writing.

This method assumes there is a single characteristic with the ids specified in characteristic. If there are multiple characteristics with the same id on a device, use resolve to find them all. Or use getDiscoveredServices to select the Services and Characteristics you're interested in.

Implementation

Future<void> writeCharacteristicWithResponse(
  QualifiedCharacteristic characteristic, {
  required List<int> value,
}) async {
  await initialize();
  await (await resolveSingle(characteristic)).write(value, withResponse: true);
}