convert method

Money convert(
  1. Money from
)

Implementation

Money convert(Money from) {
  assert(
    from.currencyCode == fromCurrency,
    'Cannot convert ${from.currencyCode} using a rate '
    'from $fromCurrency to $toCurrency',
  );
  return Money(amount: from.amount * rate, currencyCode: toCurrency);
}