parseInt static method
Creates an Integer from a string representation.
str the string to parse
radix the radix to use for parsing (default is 10)
Throws InvalidFormatException if the string cannot be parsed.
Example:
Integer a = Integer.parseInt("42");
Integer b = Integer.parseInt("1010", 2); // binary
Integer c = Integer.parseInt("FF", 16); // hexadecimal
A wrapper class for int that provides Java-like functionality and methods.
This class wraps Dart's primitive int type and provides additional utility methods similar to Java's Integer class, making it easier for Java developers to work with integers in Dart.
Example usage:
Integer a = Integer(42);
Integer b = Integer.valueOf(10);
Integer c = Integer.parseInt("123");
print(a.toString()); // "42"
print(a.compareTo(b)); // 1 (since 42 > 10)
print(Integer.max(a.value, b.value)); // 42
Implementation
static Integer parseInt(String str, [int radix = 10]) {
return Integer(int.parse(str, radix: radix));
}