tryParse static method

Fixed? tryParse(
  1. String amount, {
  2. int scale = 2,
  3. bool invertSeparator = false,
})

Works the same as Fixed.parse but returns a null if the amount cannot be parsed.

Sets the scale of the returned number to scale.

scale defaults to 2 if not passed.

Implementation

static Fixed? tryParse(
  String amount, {
  //String pattern = '#.#',
  int scale = 2,
  bool invertSeparator = false,
}) {
  try {
    return Fixed.parse(amount,
        //pattern: pattern,
        scale: scale,
        invertSeparator: invertSeparator);
  } on FixedParseException catch (_) {
    return null;
  }
}