toJson method
Implementation
Map<String, dynamic> toJson() {
final List<Map<String, dynamic>> options = [
for (final option in _options) option.toJson(),
for (final subCommand in _subCommands) subCommand.toJson(),
for (final group in _groups) group.toJson(),
];
return {
'name': _name,
'description': _description,
if (_subCommands.isEmpty && _groups.isEmpty)
'type': CommandType.subCommand.value,
'options': options,
};
}