web3dart icon indicating copy to clipboard operation
web3dart copied to clipboard

hexToInt raises exception on null string or "0x".

Open aegisdino opened this issue 2 years ago • 1 comments

When hex string is null string or 0x hexToInt raises exception. So, hexToInt should be changed like the following.

///Takes the hexadecimal input and creates a [BigInt].
BigInt hexToInt(String hex) {
  if (hex == '' || hex == '0x') return BigInt.from(0);
  return BigInt.parse(strip0x(hex), radix: 16);
}

aegisdino avatar May 05 '22 11:05 aegisdino

@aegisdino Please create a PR

TheGreatAxios avatar Jun 26 '22 22:06 TheGreatAxios