ServiceReference constructor

ServiceReference({
  1. Blob? id,
  2. Map<Text, FunctionReference>? put_methods,
  3. bool isTypeStance = false,
  4. Map<Text, CandidType>? methods_types,
})

Implementation

ServiceReference({this.id,  Map<Text, FunctionReference>? put_methods, this.isTypeStance=false, this.methods_types}) {
    if (isTypeStance==true) {
        if (this.id != null) {
            throw Exception('id must be null when isTypeStance==true'); // because if its a type-stance that means we only have its data of the type_table and havent called M_backwards() on it yet so we dont know if it has a blob id or not
        }
        if (this.methods_types == null) {
            throw Exception('when isTypeStance==true on a ServiceReference it needs a methods_types = {}');
        }
    } else {
        if (this.methods_types != null) {
            throw Exception('methods_types can only be given when isTypeStance==true');
        }
    }
    if (put_methods != null) {
        this.methods = put_methods;
    }
}