decoding<T> static method

Money decoding<T>(
  1. T value,
  2. MoneyDecoder<T> decoder
)

Returns a Money instance decoded from value by decoder.

Create your own decoders to convert from any type to a Money instance.

Throws FormatException when the passed value contains an invalid format.

Implementation

// ignore: prefer_constructors_over_static_methods
static Money decoding<T>(T value, MoneyDecoder<T> decoder) {
  final data = decoder.decode(value);

  return Money._from(
      Fixed.copyWith(data.amount, scale: data.currency.decimalDigits),
      data.currency);
}