allocator static method

ByteBufAllocator allocator({
  1. int? initialCapacity,
  2. int? maxCapacity,
})

Creates a new ByteBufAllocator with the default ByteBufAllocator.capacity of kDefaultByteBufSize or if specified initialCapacity and the default ByteBufAllocator.maxCapacity of kDefaultMaxByteBufSize or if specified maxCapacity.

Implementation

static ByteBufAllocator allocator({int? initialCapacity, int? maxCapacity}) {
  var backingBuffer = ByteBuf.createHeap(
      initialCapacity: initialCapacity, maxCapacity: maxCapacity);
  return InstantRestructuringAllocator(backingBuffer);
}