operator - method

Money operator -(
  1. covariant Money other
)

Defines the subtraction operator.

Implementation

Money operator -(covariant Money other) => other.currency != currency
    ? throw const FormatException(
        'You cannot subtract a money with a currency from another money with'
        ' a different currency. Before subtracting, convert one of them.')
    : Money(
        amount: amount - other.amount,
        currency: currency,
      );