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

Constructors

FallbackConverter(Iterable<Converter<T>> converters, {Iterable<ArgChoiceBuilder>? choices, CommandOptionType? type, void processOptionCallback(CommandOptionBuilder)?, FutureOr<Iterable<ArgChoiceBuilder>?> autocompleteCallback(AutocompleteContext)?})
Create a new FallbackConverter.
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.
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.
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.
read-only, override

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