operator + method

Options operator +(
  1. Options other
)

When merging options we can use the + operator to merge the values

Implementation

Options operator +(Options other) {
  final result = Options();

  void mergeOption(Option<dynamic> option) {
    result.setOption(
      option.name,
      (option + other.getOption(option.name)).value,
    );
  }

  options.forEach(mergeOption);

  return result;
}