writeCharacteristic method

Future<Characteristic> writeCharacteristic(
  1. String characteristicUuid,
  2. Uint8List value,
  3. bool withResponse, {
  4. String? transactionId,
})

Writes the value to the Characteristic identified by characteristicUuid.

It returns a Future that completes with the Characteristic for the convenience of chaining operations.

Operation will succeed only if Characteristic where Characteristic.isWritableWithResponse or Characteristic.isWritableWithoutResponse is true and withResponse is specified accordingly can be written to.

Implementation

Future<Characteristic> writeCharacteristic(
  String characteristicUuid,
  Uint8List value,
  bool withResponse, {
  String? transactionId,
}) =>
    _manager.writeCharacteristicForService(
        peripheral,
        this,
        characteristicUuid,
        value,
        withResponse,
        transactionId ?? TransactionIdGenerator.getNextId());