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 V2TimValueCallback(
      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 V2TimValueCallback(
      code: this.code,
      desc: this.desc,
      data: this.data == null
          ? null
          : (this.data as V2TimGroupApplicationResult).toJson(),
    );
  }
  if (T.toString() == 'V2TimConversationResult') {
    return V2TimValueCallback(
      code: this.code,
      desc: this.desc,
      data: this.data == null
          ? null
          : (this.data as V2TimConversationResult).toJson(),
    );
  }
  if (T.toString() == 'V2TimConversation') {
    return V2TimValueCallback(
      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 V2TimValueCallback(
      code: this.code,
      desc: this.desc,
      data: this.data == null
          ? null
          : (this.data as V2TimFriendOperationResult).toJson(),
    );
  }
  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 V2TimValueCallback(
      code: this.code,
      desc: this.desc,
      data: this.data == null
          ? null
          : (this.data as V2TimFriendCheckResult).toJson(),
    );
  }
  if (T.toString() == 'V2TimFriendApplicationResult') {
    return V2TimValueCallback(
      code: this.code,
      desc: this.desc,
      data: this.data == null
          ? null
          : (this.data as V2TimFriendApplicationResult).toJson(),
    );
  }
  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(),
    };
  }
  return <String, dynamic>{
    "code": this.code,
    "desc": this.desc,
    "data": this.data
  };
}