parseBigInt function
Parses o
as BigInt. If can't parse returns def
.
Implementation
BigInt? parseBigInt(dynamic o, [BigInt? def]) {
if (o == null) return def;
if (o is BigInt) return o;
if (o is num) return BigInt.from(o);
var s = o.toString().trim();
return BigInt.tryParse(s) ?? parseNum(s)?.toBigInt() ?? def;
}