FallbackConverter<T> class
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:
- CombineConverter, for further processing the output of another converter.
- Implemented types
-
- Converter<
T>
- Converter<
Constructors
-
FallbackConverter(Iterable<
Converter< converters, {Iterable<T> >CommandOptionChoiceBuilder> ? choices, CommandOptionType? type, void processOptionCallback(CommandOptionBuilder)?, FutureOr<Iterable< autocompleteCallback(AutocompleteContext)?, FutureOr<CommandOptionChoiceBuilder> ?>SelectMenuOptionBuilder> toSelectMenuOption(T)?, FutureOr<ButtonBuilder> toButton(T)?}) -
Create a new FallbackConverter.
const
Properties
-
autocompleteCallback
→ (FutureOr<
Iterable< Function(AutocompleteContext)?)CommandOptionChoiceBuilder> ?> -
A function called to provide autocompletion
for arguments of this type.
final
-
choices
→ Iterable<
CommandOptionChoiceBuilder> ? -
The choices for this type.
no setteroverride
-
convert
→ FutureOr<
T?> Function(StringView view, ContextData context) -
The function called to perform the conversion.
no setteroverride
-
converters
→ Iterable<
Converter< T> > -
The converters this FallbackConverter will attempt to use.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
output
→ RuntimeType<
T> -
The type that this converter parses.
no setteroverride
- 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.
no setterinherited
-
toButton
→ (FutureOr<
ButtonBuilder> Function(T)?) -
A function called to provide ButtonBuilders that can be used to represent an element
converted by this converter.
no setteroverride
-
toSelectMenuOption
→ (FutureOr<
SelectMenuOptionBuilder> Function(T)?) -
A function called to provide SelectMenuOptionBuilders that can be used to represent an
element converted by this converter.
no setteroverride
- type → CommandOptionType
-
The Discord Slash Command Argument Type
of the type that this converter parses.
no setteroverride
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited