writeValue method

Future<void> writeValue({
  1. required String value,
  2. int? writeType,
})

Writes a string to this characteristic.

value - The string to be written. It is encoded as UTF-8 before being sent, so only ASCII characters map to single bytes with the same value. To send arbitrary byte values, use writeBytes instead. writeType - Optional write type, defaulting to BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT.

Implementation

Future<void> writeValue({
  required String value,
  int? writeType,
}) async {
  return CentralPlatformInterface.instance.writeCharacteristic(
    characteristic: this,
    value: utf8.encode(value),
    writeType: writeType,
  );
}