FunctionReference constructor

FunctionReference({
  1. required List<CandidType> in_types,
  2. required List<CandidType> out_types,
  3. bool isQuery = false,
  4. bool isOneWay = false,
  5. ServiceReference? service,
  6. Text? method_name,
  7. bool type_mode = false,
})

Implementation

FunctionReference({required this.in_types, required this.out_types, this.isQuery=false, this.isOneWay=false, this.service, this.method_name, this.type_mode=false}) {
    for (List<CandidType> types_list in [in_types, out_types]) {
        for (CandidType typestance in types_list) {
            if (typestance.type_mode==false) {
                throw Exception('CandidType: FunctionReference in_types & out_types lists needs each type-stance/finition with the type_mode=true, since these are the type-finitions for the function, not values.');
            }
        }
    }
    if ( (this.service != null && this.method_name == null) || (this.service == null && this.method_name != null)) {
        throw Exception('CandidType: FunctionReference service and method_name must be given both together or both null.');
    }
    if (this.type_mode==true && this.service != null) {
        throw Exception('CandidType: FunctionReference service & method_name must be null when type_mode==true');
    }
}