M method

MfuncTuple M(
  1. Uint8List candidbytes,
  2. CandidBytes_i start_i
)
override

Implementation

MfuncTuple M(Uint8List candidbytes, CandidBytes_i start_i) {
    if (this.isTypeStance==false) { throw Exception('this function is call on a stance with the isTypeStance==true and a Map<Text, FunctionReference> methods_types'); }
    Blob? id_value;
    late CandidBytes_i next_i;
    if (candidbytes[start_i] == 0) {
        next_i = start_i + 1;
    } else if (candidbytes[start_i] == 1) {
        MfuncTuple id_m_func_tuple = Vector(isTypeStance: true, values_type: Nat8()).M(candidbytes, start_i + 1);
        Vector<Nat8> id_value_vecnat8 = Vector.oftheList<Nat8>((id_m_func_tuple.item1 as Vector).cast<Nat8>());
        id_value = Blob.oftheVector(id_value_vecnat8);
        next_i = id_m_func_tuple.item2;
    }
    ServiceReference service = ServiceReference(id: id_value);
    for (MapEntry func_me in this.methods_types!.entries) {
        FunctionReference func_ref = func_me.value.M(Uint8List(1), 0).item1 as FunctionReference; // getting the FunctionReference types from the type_table without a service or method_name
        service.methods[func_me.key] = FunctionReference(
            service: service,
            method_name: func_me.key,     // putting this service and method_name of this method on this FunctionReference
            in_types: func_ref.in_types,
            out_types: func_ref.out_types,
            isQuery: func_ref.isQuery,
            isOneWay: func_ref.isOneWay
        );
    }
    return MfuncTuple(service, next_i);
}