writeFunc function Null safety

void writeFunc(
  1. Pointer<Void> stream,
  2. Pointer<Void> data,
  3. int bytesCount
)

Implementation

void writeFunc(Pointer<Void> stream, Pointer<Void> data, int bytesCount) {
  Pointer<Pointer<Uint8>> buffer_stream = stream.cast();
  Pointer<Int32> currentByteCount = Pointer.fromAddress(buffer_stream[0].address);

  if (bytesCount != 0) {
    for (var i = 0; i < bytesCount; i++) {
      buffer_stream[1][currentByteCount.value + i] = Pointer<Uint8>.fromAddress(data.address + i).value;
    }
    currentByteCount.value += bytesCount;
  }
}