ensureCapacity method

  1. @override
void ensureCapacity(
  1. int needed
)
override

Ensures that capacity can store the needed bytes.

Implementation

@override
void ensureCapacity(int needed) {
  if (capacity < needed) {
    var newCapacity = math.max(capacity * 2, needed);
    var bs = Uint8List(newCapacity);
    bs.setAll(0, _bytes);
    _bytes = bs;
    bytesData = ByteDataIntCodec(_bytes.asByteData());
  }
}