getContentEncoded static method

Uint8List getContentEncoded(
  1. Uint8List encoded
)

Take the bytes after the first 2 bytes in the byte array (consider the byte array to be an encoding for ABI dynamic typed value) @param encoded an ABI encoding byte array @return the tailing bytes after the first 2 bytes of the ABI encoding byte array @throws IllegalArgumentException if the encoded byte array has length < 2

Implementation

static Uint8List getContentEncoded(Uint8List encoded) {
  if (encoded.length < ABI_DYNAMIC_HEAD_BYTE_LEN) {
    throw ArgumentError('encode byte size too small, less than 2 bytes');
  }
  final encodedString = Uint8List(encoded.length - ABI_DYNAMIC_HEAD_BYTE_LEN);
  Array.copy(encoded, ABI_DYNAMIC_HEAD_BYTE_LEN, encodedString, 0,
      encoded.length - ABI_DYNAMIC_HEAD_BYTE_LEN);
  return encodedString;
}