bnToBn function
BigInt
bnToBn(
- dynamic value
)
Implementation
BigInt bnToBn(dynamic value) {
if (value == null) {
return BigInt.zero;
}
BigInt? result;
if (value is BigInt) {
return value;
} else if (value is int) {
return BigInt.from(value);
} else if (value is Map<String, dynamic>) {
return compactToBn(value);
} else if (value is String) {
if (isHex(value)) {
return hexToBn(value);
}
result = BigInt.tryParse(value, radix: 10);
}
if (result != null) {
return result;
}
throw UnreachableError();
}