parseLong static method
Parses a string to a Long.
str
the string to parse
radix
the radix to use for parsing (default is 10)
Throws InvalidFormatException if the string cannot be parsed.
A wrapper class for large integers that provides Java-like functionality.
This class wraps Dart's int type but is designed for large integer values, similar to Java's Long class.
Example usage:
Long a = Long(9223372036854775807);
Long b = Long.valueOf(1000000000000);
Long c = Long.parseLong("123456789012345");
print(a.toString()); // "9223372036854775807"
print(a.compareTo(b)); // 1
Implementation
static Long parseLong(String str, [int radix = 10]) {
try {
return Long(int.parse(str, radix: radix));
} catch (e) {
throw InvalidFormatException('Invalid long value: $str');
}
}