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(),
    };
  } else if (T.toString() == 'List<V2TimFriendInfo>') {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as List)
          .map((e) => (e as V2TimFriendInfo).toJson())
          .toList(),
    };
  } else if (T.toString() == 'List<String>') {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as List).map((e) => e as String).toList(),
    };
  } else if (T == V2TimMemberEnter) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMemberEnter).toJson()
    };
  } else if (T == V2TimMemberLeave) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMemberLeave).toJson()
    };
  } else if (T == V2TimMemberInvited) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMemberInvited).toJson()
    };
  } else if (T == V2TimMemberKicked) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMemberKicked).toJson()
    };
  } else if (T == V2TimMemberInfoChanged) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimMemberInfoChanged).toJson()
    };
  } else if (T == V2TimGroupCreated) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGroupCreated).toJson()
    };
  } else if (T == V2TimGroupDismissed) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGroupDismissed).toJson()
    };
  } else if (T == V2TimGroupRecycled) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGroupRecycled).toJson()
    };
  } else if (T == V2TimGroupInfoChanged) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGroupInfoChanged).toJson()
    };
  } else if (T == V2TimReceiveJoinApplication) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimReceiveJoinApplication).toJson()
    };
  } else if (T == V2TimApplicationProcessed) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimApplicationProcessed).toJson()
    };
  } else if (T == V2TimGrantAdministrator) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGrantAdministrator).toJson()
    };
  } else if (T == V2TimRevokeAdministrator) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimRevokeAdministrator).toJson()
    };
  } else if (T == V2TimQuitFromGroup) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimQuitFromGroup).toJson()
    };
  } else if (T == V2TimReceiveRestCustomData) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimReceiveRestCustomData).toJson()
    };
  } else if (T == V2TimGroupAttributeChanged) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimGroupAttributeChanged).toJson()
    };
  } else if (T == MessageProgress) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as MessageProgress).toJson()
    };
  } else if (T == V2TimSignalFullinfo) {
    return <String, dynamic>{
      "type": this.type,
      "data": (this.data as V2TimSignalFullinfo).toJson()
    };
  }
  return <String, dynamic>{
    "type": this.type,
    "data": this.data,
  };
}