operator | method

RomanNumerals operator |(
  1. dynamic other
)

Bit-wise or operator

Implementation

RomanNumerals operator |(dynamic other) {
  int newValue = 0;
  if (other is num) {
    newValue = value | other.toInt();
  } else if (other is String && _validateRoman(other)) {
    newValue = value | RomanNumerals.fromRoman(other).value;
  } else if (other is RomanNumerals) {
    newValue = value | other.value;
  } else {
    throw InvalidRomanNumeralException('Not valid type for Roman numerals.');
  }
  return RomanNumerals(newValue);
}