tryParseWith<R, P extends NumberParserBase<R>> method

R? tryParseWith<R, P extends NumberParserBase<R>>(
  1. P parserGenerator(
    1. NumberFormat,
    2. String
    ),
  2. String text
)

Parse the number represented by the string using the parser created by the supplied parser generator. If it's not parsable, returns null.

Implementation

R? tryParseWith<R, P extends NumberParserBase<R>>(
    P Function(NumberFormat, String) parserGenerator, String text) {
  try {
    return parseWith(parserGenerator, text);
  } on FormatException {
    return null;
  }
}