writeBytes method

Future<void> writeBytes({
  1. required List<int> bytes,
  2. int? writeType,
})

Writes raw bytes to this characteristic exactly as provided, without any text encoding.

bytes - The bytes to be written. Each element must be in the range 0-255. Use this for devices whose BLE protocol interprets raw byte values (flags, length prefixes, checksums, etc.). writeType - Optional write type, defaulting to BluetoothGattCharacteristic.WRITE_TYPE_DEFAULT.

Example:

await characteristic.writeBytes(bytes: <int>[0x01, 0xFF, 0x80]);

Implementation

Future<void> writeBytes({
  required List<int> bytes,
  int? writeType,
}) async {
  return CentralPlatformInterface.instance.writeCharacteristic(
    characteristic: this,
    value: bytes,
    writeType: writeType,
  );
}