addFlag method

Arg<bool> addFlag(
  1. String name, {
  2. String? description,
  3. UsageGroup? usageGroup,
  4. String? short,
  5. String? inverse,
  6. bool defaultValue = false,
  7. void onParse(
    1. bool value
    )?,
})

Adds a new boolean flag.

If short is not null, it will be used as a short option alias for this long option.

If inverse is not null, it will be used as the name of an "inverse" flag, i.e. a flag that, when given, will set this to false rather than true. If null, then the default inverse generator specified in this parser's ArgConfig will be used. If you want to opt this flag out of inverse generation altogether, pass disableFlagInverse to inverse.

Implementation

Arg<bool> addFlag(String name,
        {String? description,
        UsageGroup? usageGroup,
        String? short,
        String? inverse,
        bool defaultValue = false,
        void Function(bool value)? onParse}) =>
    addMultiFlag(name,
        description: description,
        usageGroup: usageGroup,
        short: short,
        inverse: inverse,
        defaultValue: defaultValue,
        accumulator: discardAccumulator,
        onParse: onParse);