byteLength method

  1. @override
int byteLength()
override

Precompute the byte size of the static ABI typed value @return the byte size of the ABI value @throws IllegalArgumentException if the ABI type is dynamic typed

Implementation

@override
int byteLength() {
  var size = 0;
  for (var i = 0; i < childTypes.length; i++) {
    if (childTypes[i] is TypeBool) {
      final after = AbiType.findBoolLR(childTypes, i, 1);
      i += after;
      final boolNumber = after + 1;
      size += boolNumber ~/ 8;
      size += (boolNumber % 8 != 0) ? 1 : 0;
    } else {
      size += childTypes[i].byteLength();
    }
  }
  return size;
}