Commander class Null safety

Lightweight command framework. Doesn't use dart:mirrors and can be used in browser. While constructing specify prefix which is string with prefix or implement PrefixHandlerFunction for more fine control over where and in what conditions commands are executed.

Allows to specify callbacks which are executed before and after command - also on per command basis. beforeCommandHandler callbacks are executed only command exists and is matched with message content.

Mixed in types


Commander(Nyxx client, {String? prefix, PrefixHandlerFunction? prefixHandler, PassHandlerFunction? beforeCommandHandler, AfterHandlerFunction? afterCommandHandler, LoggerHandlerFunction? loggerHandlerFunction, CommandExecutionError? commandExecutionError})
Either prefix or prefixHandler must be specified otherwise program will exit. Allows to specify additional beforeCommandHandler executed before main command callback, and afterCommandHandler executed after main command callback.


commands List<CommandEntity>
Returns unmodifiable list of registered commands.
hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


getPrefixForMessage(Message message) FutureOr<String?>
Resolves prefix for given message. Returns null if there is no prefix for given message which means command wouldn't execute in given context.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
registerCommand(String commandName, CommandHandlerFunction commandHandler, {PassHandlerFunction? beforeHandler, AfterHandlerFunction? afterHandler}) → void
Registers command with given commandName. Allows to specify command specific before and after command execution callbacks
registerCommandEntity(CommandEntity entity) → void
Registers CommandEntity within context of this instance. Throws error if there is command with same name as provided.
registerCommandGroup(CommandGroup commandGroup) → void
Registers command as implemented CommandEntity class
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]