tryParse method

Decimal? tryParse(
  1. String text
)

Parses text as a decimal literal using the provided number formatter and returns its value as Decimal, or null if the parsing fails.

Implementation

Decimal? tryParse(String text) {
  try {
    return parse(text);
  } on FormatException {
    return null;
  }
}