tryParse static method

Decimal? tryParse(
  1. String s, {
  2. int? precision,
  3. String decimalDelimiter = '.',
})
override

Tries to parse String s to a Decimal.

Implementation

static Decimal? tryParse(String s,
    {int? precision, String decimalDelimiter = '.'}) {
  if (s.isEmpty) return null;

  try {
    return Decimal.parse(s,
        precision: precision, decimalDelimiter: decimalDelimiter);
  } on FormatException {
    return null;
  }
}