parseUserNumber function

BigInt? parseUserNumber(
  1. String s
)

BigInt parses various things we do not want to allow, like:

  • BigInt(whitespace) == 0
  • Hex/Octal formatted numbers
  • Scientific notation So we check that the user has entered a sequence of digits only, before attempting to parse.

Implementation

BigInt? parseUserNumber(String s) {
  return BigInt.tryParse(s, radix: 10);
}