tryParse static method
Tries to parse a dynamic value v
into a BigInt, returning null if parsing fails.
Attempts to parse the dynamic value v
into a BigInt using the parse method.
If successful, returns the resulting BigInt; otherwise, returns null.
allowHex: convert hexadecimal to integer
Parameters:
v
: The dynamic value to be parsed into a BigInt.
Returns:
- A BigInt if parsing is successful; otherwise, returns null.
Implementation
static BigInt? tryParse(dynamic v, {bool allowHex = true}) {
if (v == null) return null;
try {
return parse(v, allowHex: allowHex);
} on ArgumentException {
return null;
}
}