parseSlashCommand function

({String args, String command})? parseSlashCommand(
  1. String input
)

Parse a slash command.

Implementation

({String command, String args})? parseSlashCommand(String input) {
  final match = _slashCommandPattern.firstMatch(input);
  if (match == null) return null;
  final command = match.group(1)!;
  final args = match.group(2)?.trim() ?? '';
  return (command: command, args: args);
}