serializeArgInner function

void serializeArgInner(
  1. dynamic argVal,
  2. TypeTag argType,
  3. Serializer serializer,
  4. int depth,
)

Implementation

void serializeArgInner(dynamic argVal, TypeTag argType, Serializer serializer, int depth) {
  if (argType is TypeTagBool) {
    serializer.serializeBool(ensureBoolean(argVal));
  } else if (argType is TypeTagU8) {
    serializer.serializeU8(ensureNumber(argVal));
  } else if (argType is TypeTagU16) {
    serializer.serializeU16(ensureNumber(argVal));
  } else if (argType is TypeTagU32) {
    serializer.serializeU32(ensureNumber(argVal));
  } else if (argType is TypeTagU64) {
    serializer.serializeU64(ensureBigInt(argVal));
  } else if (argType is TypeTagU128) {
    serializer.serializeU128(ensureBigInt(argVal));
  } else if (argType is TypeTagU256) {
    serializer.serializeU256(ensureBigInt(argVal));
  } else if (argType is TypeTagAddress) {
    _serializeAddress(argVal, serializer);
  } else if (argType is TypeTagVector) {
    _serializeVector(argVal, argType, serializer, depth);
  } else if (argType is TypeTagStruct) {
    _serializeStruct(argVal, argType, serializer, depth);
  } else {
    throw ArgumentError("Unsupported arg type.");
  }
}