Builder constructor

Builder(
  1. {int initialSize = 1024,
  2. bool internStrings = false,
  3. Allocator allocator = const DefaultAllocator(),
  4. bool deduplicateTables = true}
)

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 = const DefaultAllocator(),
  this.deduplicateTables = true,
})  : _allocator = allocator,
      _buf = allocator.allocate(initialSize),
      _vTables = deduplicateTables ? [] : const [] {
  if (internStrings) {
    _strings = <String, int>{};
  }
}