Choices class Null safety

An annotation used to restrict input to a set of choices for a given parameter.

Note that this is only a client-side verification for Slash Commands only, input from text commands might not be one of the options.

For example, adding three choices to a command:

ChatCommand test = ChatCommand(
  'test',
  'A test command',
  (
    IChatContext context,
    @Choices({'Foo': 'foo', 'Bar': 'bar', 'Baz': 'baz'}) String message,
  ) async {
    context.respond(MessageBuilder.content(message));
  },
);

commands.addCommand(test);

Constructors

Choices(Map<String, dynamic> choices)
Create a new Choices.
const

Properties

builders Iterable<ArgChoiceBuilder>
Get the builders that this Choices represents.
read-only
choices Map<String, dynamic>
The choices for this command.
final
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

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited