toJson method

dynamic toJson()

Implementation

toJson() {
  if (T == V2TimMessage) {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null ? null : (this.data as V2TimMessage).toJson()
    };
  }
  if (T.toString() == 'List<V2TimUserFullInfo>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimUserFullInfo).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimGroupInfo>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimGroupInfo).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimGroupInfoResult>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List?)?.map((e) {
              return (e as V2TimGroupInfoResult).toJson();
            })?.toList(),
    };
  }
  if (T.toString() == 'V2TimGroupMemberInfoResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as V2TimGroupMemberInfoResult).toJson()
    };
  }
  if (T.toString() == 'List<V2TimGroupMemberFullInfo>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimGroupMemberFullInfo).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimGroupMemberOperationResult>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimGroupMemberOperationResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'V2TimGroupApplicationResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as V2TimGroupApplicationResult).toJson()
    };
  }
  if (T.toString() == 'V2TimConversationResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as V2TimConversationResult).toJson()
    };
  }
  if (T.toString() == 'V2TimConversation') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data":
          this.data == null ? null : (this.data as V2TimConversation).toJson()
    };
  }
  if (T.toString() == 'List<V2TimFriendInfo>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendInfo).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimFriendInfoResult>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendInfoResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'V2TimFriendOperationResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendOperationResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimFriendOperationResult>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendOperationResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'V2TimFriendCheckResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendCheckResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimFriendCheckResult>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendCheckResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'V2TimFriendApplicationResult') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendApplicationResult).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimFriendGroup>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimFriendGroup).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'List<V2TimMessage>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null
          ? null
          : (this.data as List)
              .map((e) => (e as V2TimMessage).toJson())
              .toList(),
    };
  }
  if (T.toString() == 'Map<String, String>') {
    return <String, dynamic>{
      "code": this.code,
      "desc": this.desc,
      "data": this.data == null ? null : this.data as Map<String, String>?,
    };
  }
  return <String, dynamic>{
    "code": this.code,
    "desc": this.desc,
    "data": this.data
  };
}