u8.parse constructor

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

8-bit Unsigned Integer

0 to 255

Parse source as a, possibly signed, integer literal and return 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 integer literal.

Implementation

u8.parse(
  String source, {
  int? radix,
}) : super(
        value: int.parse(
          source,
          radix: radix,
        ).toUnsigned(8),
      );