addCommand method Null safety

  1. @override
void addCommand(
  1. GroupMixin command
)
override

Add a child to this group.

If any of its name or aliases confict with already registered commands, a CommandRegistrationError is thrown.

If child already has a parent, an CommandRegistrationError is thrown.

Implementation

@override
void addCommand(GroupMixin command) {
  if (type != CommandType.textOnly) {
    if (command.hasSlashCommand || (command is Command && command.type != CommandType.textOnly)) {
      throw CommandRegistrationError('Cannot nest Slash commands!');
    }
  }

  super.addCommand(command);
}