addMultiFlag<U> method

Arg<U> addMultiFlag<U>(
  1. String name, {
  2. String? description,
  3. UsageGroup? usageGroup,
  4. String? short,
  5. String? inverse,
  6. required U defaultValue,
  7. required Accumulator<bool, U> accumulator,
  8. void onParse(
    1. bool value
    )?,
})

Adds a new boolean flag that can be passed multiple times.

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<U> addMultiFlag<U>(String name,
        {String? description,
        UsageGroup? usageGroup,
        String? short,
        String? inverse,
        required U defaultValue,
        required Accumulator<bool, U> accumulator,
        void Function(bool value)? onParse}) =>
    _base.addOption(name,
        description: description,
        valueDescription: null,
        usageGroup: usageGroup,
        short: short,
        flag: Flag(inverse: inverse),
        defaultValue: defaultValue,
        parser: boolValueParser.also(onParse ?? (_) {}),
        accumulator: accumulator);