RawWriter.withCapacity constructor

RawWriter.withCapacity(
  1. int capacity, {
  2. bool isExpanding = true,
})

Constructor that allocates a new buffer with the capacity.

If isExpanding is true, buffer is automatically is expanded.

Implementation

factory RawWriter.withCapacity(int capacity, {bool isExpanding = true}) {
  return new RawWriter.withByteData(
    new ByteData(capacity),
    isExpanding: isExpanding,
  );
}