M method
MfuncTuple
M(
- Uint8List candidbytes,
- CandidBytes_i start_i
)
override
Implementation
MfuncTuple M(Uint8List candidbytes, CandidBytes_i start_i) {
Tuple2<Uint8List,CandidBytes_i> leb128_bytes_tuple = find_leb128bytes(candidbytes, start_i);
BigInt vec_len_b = leb128.decodeUnsigned(leb128_bytes_tuple.item1);
late int vec_len;
if (vec_len_b.isValidInt) {
vec_len = vec_len_b.toInt();
} else {
throw Exception('these candid-bytes are too big for this dart code to handle, there are more than 2^64 bytes. these candid-bytes are held in lists and a dart-list can only index up to 2^64-1, the max of the dart-int. ');
}
late Vector vec;
CandidBytes_i next_vec_item_start_i = leb128_bytes_tuple.item2;
if (this.values_type! is Nat8) {
CandidBytes_i finish_nat8s_i = next_vec_item_start_i + vec_len;
vec = Blob(candidbytes.sublist(next_vec_item_start_i, finish_nat8s_i));
next_vec_item_start_i = finish_nat8s_i;
} else {
vec = Vector(values_type: this.values_type is TypeTableReference ? (this.values_type as TypeTableReference).get_final_type_stance() : this.values_type);
for (int i=0;i<vec_len;i=i+1) {
MfuncTuple m_func_tuple = this.values_type!.M(candidbytes, next_vec_item_start_i);
vec.add(m_func_tuple.item1);
next_vec_item_start_i = m_func_tuple.item2;
}
}
return MfuncTuple(vec, next_vec_item_start_i);
}