Builder constructor

Builder({
  1. int initialSize = 1024,
  2. bool internStrings = false,
  3. Allocator? allocator,
})

Creates a new FlatBuffers Builder.

initialSize is the initial array size in bytes. The Builder will automatically grow the array if/as needed. internStrings, if set to true, will cause writeString to pool strings in the buffer so that identical strings will always use the same offset in tables.

Implementation

Builder(
    {this.initialSize: 1024,
    bool internStrings = false,
    Allocator? allocator})
    : _allocator = allocator ?? DefaultAllocator() {
  _buf = _allocator.allocate(initialSize);
  _allocator.clear(_buf, true);
  if (internStrings == true) {
    _strings = new Map<String, int>();
  }
}