readFunc function Null safety

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

Implementation

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

  if (bytesCount != 0) {
    for (var i = 0; i < bytesCount; i++) {
      data_stream[i] = buffer_stream[1][currentByteCount.value + i];
    }
    currentByteCount.value += bytesCount;
  }
}