operator - method

Money operator -(
  1. Money other
)

Subtract two Money amounts (must be same currency)

Implementation

Money operator -(Money other) {
  if (currency != other.currency) {
    throw ArgumentError('Cannot subtract different currencies');
  }
  return Money(amount: amount - other.amount, currency: currency);
}