tryParse static method

CurrencyAmount? tryParse(
  1. String s, {
  2. required Currency currency,
})

Implementation

static CurrencyAmount? tryParse(String s, {required Currency currency}) {
  final decimal = Decimal.tryParse(s);
  if (decimal == null) {
    return null;
  }
  return CurrencyAmount.fromDecimal(decimal, currency: currency);
}