addComponent method

void addComponent(
  1. MessageComponent component
)

Implementation

void addComponent(MessageComponent component) {
  if (component is RowBuilder) {
    throw Exception('You can not add a RowBuilder to another RowBuilder.');
  }

  if (_components.length >= 5) {
    throw TooManyElementException(
        'You give ${_components.length + 1} components but this row can only have 5.');
  }

  _components.add(component);
}