write method
Writes a list of bytes to the serial port. Returns the number of bytes written on success,
Implementation
int write(List<int> list) {
_checkStatus();
if (list.isEmpty) {
return 0;
}
var ptr = malloc<Uint8>(list.length);
try {
var index = 0;
for (var i in list) {
ptr[index++] = i;
}
var result = _nativeSerialWrite(_serialHandle, ptr, list.length);
return _checkError(result);
} finally {
malloc.free(ptr);
}
}