FallbackConverter<T> class Null safety

A converter that successively tries a list of converters until one succeeds.

Given three converters a, b and c, a FallbackConverter will first try to convert the input using a, then, if a failed, using b, then, if b failed, using c. If all of a, b and c fail, then the FallbackConverter will also fail. If at least one of a, b or c succeed, the FallbackConverter will return the result of that conversion.

You might also be interested in:

Implemented types


FallbackConverter(Iterable<Converter<T>> converters, {Iterable<ArgChoiceBuilder>? choices, CommandOptionType? type, void processOptionCallback(CommandOptionBuilder)?, FutureOr<Iterable<ArgChoiceBuilder>?> autocompleteCallback(AutocompleteContext)?})
Create a new FallbackConverter.


autocompleteCallback → (FutureOr<Iterable<ArgChoiceBuilder>?> Function?(AutocompleteContext)?)
A function called to provide autocompletion for arguments of this type.
choices Iterable<ArgChoiceBuilder>?
The choices for this type.
read-only, override
convert FutureOr<T?> Function(StringView view, IChatContext context)
The function called to perform the conversion.
read-only, override
converters Iterable<Converter<T>>
The converters this FallbackConverter will attempt to use.
hashCode int
The hash code for this object.
read-only, inherited
output Type
The type that this converter parses.
processOptionCallback → (void Function?(CommandOptionBuilder)?)
A callback called with the CommandOptionBuilder created for an option using this converter.
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.
read-only, override


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


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