toJson method

dynamic toJson ()

Implementation

toJson() {
  if (T == V2TimUserFullInfo) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimUserFullInfo).toJson()
    };
  } else if (T == V2TimCallback) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimCallback).toJson()
    };
  } else if (T == V2TimRecvC2cTextMessage) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimRecvC2cTextMessage).toJson()
    };
  } else if (T == V2TimRecvC2cCustomMessage) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimRecvC2cCustomMessage).toJson()
    };
  } else if (T == V2TimRecvGroupTextMessage) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimRecvGroupTextMessage).toJson()
    };
  } else if (T == V2TimRecvGroupCustomMessage) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimRecvGroupCustomMessage).toJson()
    };
  } else if (T == V2TimMessage) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMessage).toJson()
    };
  } else if (T.toString() == "List<V2TimMessageReceipt>") {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as List)
          .map((e) => (e as V2TimMessageReceipt).toJson())
          .toList(),
    };
  }
  return <String, dynamic>{
    "type": this.type,
    "data": this.data,
  };
}