parse method

BigInt parse (
  1. String source,
  2. {int? radix}
)

Parses source as a, possibly signed, integer literal and returns its value.

The source must be a non-empty sequence of base-radix digits, optionally prefixed with a minus or plus sign ('-' or '+').

The radix must be in the range 2..36. The digits used are first the decimal digits 0..9, and then the letters 'a'..'z' with values 10 through 35. Also accepts upper-case letters with the same values as the lower-case ones.

If no radix is given then it defaults to 10. In this case, the source digits may also start with 0x, in which case the number is interpreted as a hexadecimal literal, which effectively means that the 0x is ignored and the radix is instead set to 16.

For any int n and radix r, it is guaranteed that n == int.parse(n.toRadixString(r), radix: r).

Throws a FormatException if the source is not a valid integer literal, optionally prefixed by a sign.

Implementation

external static BigInt parse(String source, {int? radix});

© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/BigInt/parse.html