operator + method

Option<T> operator +(
  1. Option<T> other
)

When merging options we can use the + operator to merge the values of the options. If there are more than one option the filled in and not the same as the default, the second option will be used.

Implementation

Option<T> operator +(Option<T> other) {
  if (name != other.name) throw 'Cannot add to options of different type';
  final newOption = copy();
  newOption.value = _getValue(value, other.value, defaultValue);
  return newOption;
}