Converter<T> class Null safety

Contains metadata and parsing capabilities for a given type.

A Converter will convert textual user input received from the Discord API to the type requested by the current command. It also contains metadata about the type it converts.

nyxx_commands provides a set of converters for common argument types, a list of which can be found below. These converters are automatically added to CommandsPlugin instances and do not need to be added manually.

The list of default converters is as follows:

You can override these default implementations with your own by calling CommandsPlugin.addConverter with your own converter for one of the types mentioned above.

You might also be interested in:

Implementers

Constructors

Converter(FutureOr<T?> convert(StringView view, IChatContext context), {Iterable<ArgChoiceBuilder>? choices, void processOptionCallback(CommandOptionBuilder)?, FutureOr<Iterable<ArgChoiceBuilder>?> autocompleteCallback(AutocompleteContext)?, CommandOptionType type = CommandOptionType.string})
Create a new converter.
const

Properties

autocompleteCallback → (FutureOr<Iterable<ArgChoiceBuilder>?> Function?(AutocompleteContext)?)
A function called to provide autocompletion for arguments of this type.
final
choices Iterable<ArgChoiceBuilder>?
The choices for this type.
final
convert FutureOr<T?> Function(StringView view, IChatContext context)
The function called to perform the conversion.
final
hashCode int
The hash code for this object.
read-only, inherited
output Type
The type that this converter parses.
final
processOptionCallback → (void Function?(CommandOptionBuilder)?)
A callback called with the CommandOptionBuilder created for an option using this converter.
final
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
type CommandOptionType
The Discord Slash Command Argument Type of the type that this converter parses.
final

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