operator + method

CurrencyAmount operator +(
  1. CurrencyAmount other
)

Adds an amount of the same currency.

Throws ArgumentError if the currencies are different.

Implementation

CurrencyAmount operator +(CurrencyAmount other) {
  if (currency.code != other.currency.code) {
    throw ArgumentError.value(other);
  }
  return CurrencyAmount.fromDecimal(amount + other.amount,
      currency: currency);
}