resize method

ByteData resize(
  1. ByteData oldData,
  2. int newSize,
  3. int inUseBack,
  4. int inUseFront,
)

Reallocate newSize bytes of memory, replacing the old oldData. This grows downwards, and is intended specifically for use with Builder. Params inUseBack and inUseFront indicate how much of oldData is actually in use at each end, and needs to be copied.

Implementation

ByteData resize(
    ByteData oldData, int newSize, int inUseBack, int inUseFront) {
  final newData = allocate(newSize);
  _copyDownward(oldData, newData, inUseBack, inUseFront);
  deallocate(oldData);
  return newData;
}