register<T extends Component> method

ComponentId register<T extends Component>(
  1. T creator(
    1. int index
    ), [
  2. int? capacity
])

Implementation

ComponentId register<T extends Component>(T Function(int index) creator, [int? capacity]) {
  assert(!registerTypes.contains(T), 'Registering component type more than once.');
  var index = _nextIndex;
  componentArrays.add(ComponentArray<T>(capacity ?? defaultCapacity, creator));
  registerTypes.add(T);
  _nextIndex++;
  return index;
}