boolConverter top-level constant Null safety

Converter<bool> const boolConverter

A Converter that converts input to a bool.

This converter will parse the input to true if the next word or quoted section of the input is one of y, yes, +, 1 or true. This comparison is case-insensitive. This converter will parse the input to false if the next work or quotetd section of the input is one of n, no, -, 0 or false. This comparison is case-insentive.

If the input is not one of the aforementioned words, this converter will fail.

This converter has a Discord Slash Command Argument Type of CommandOptionType.boolean.

Implementation

const Converter<bool> boolConverter = Converter<bool>(
  convertBool,
  type: CommandOptionType.boolean,
);