ServiceReference constructor

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

Implementation

ServiceReference({this.id,  Map<Text, FunctionReference>? put_methods, this.type_mode=false, this.methods_types}) {
    if (type_mode==true) {
        if (this.id != null) {
            throw Exception('id must be null when type_mode==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 type_mode==true on a ServiceReference it needs a methods_types = {}');
        }
    } else {
        if (this.methods_types != null) {
            throw Exception('methods_types can only be given when type_mode==true');
        }
    }
    if (put_methods != null) {
        this.methods = put_methods;
    }
}