chainId property

int? get chainId
override

The chainId is optional for transactions with v = 27 or v = 28 (EIP-155) For other transactions, chainId is calculated as (v - 35) / 2 for odd v and (v - 36) / 2 for even v

Implementation

int? get chainId {
  if (v == 27 || v == 28) {
    return null;
  }

  if (v.isOdd) {
    return (v - 35) ~/ 2;
  }

  return (v - 36) ~/ 2;
}