V2TimEventCallback<T>.fromJson constructor
V2TimEventCallback<T>.fromJson(- Map<String, dynamic> json
)
Implementation
factory V2TimEventCallback.fromJson(Map<String, dynamic> json) {
if (T == V2TimUserFullInfo) {
return V2TimEventCallback(
type: json['type'],
data: V2TimUserFullInfo.fromJson(json['data']) as T,
);
} else if (T == V2TimCallback) {
return V2TimEventCallback(
type: json['type'],
data: V2TimCallback.fromJson(json['data']) as T,
);
} else if (T == V2TimRecvC2cTextMessage) {
return V2TimEventCallback(
type: json['type'],
data: V2TimRecvC2cTextMessage.fromJson(json['data']) as T,
);
} else if (T == V2TimRecvC2cCustomMessage) {
return V2TimEventCallback(
type: json['type'],
data: V2TimRecvC2cCustomMessage.fromJson(json['data']) as T,
);
} else if (T == V2TimRecvGroupTextMessage) {
return V2TimEventCallback(
type: json['type'],
data: V2TimRecvGroupTextMessage.fromJson(json['data']) as T,
);
} else if (T == V2TimRecvGroupCustomMessage) {
return V2TimEventCallback(
type: json['type'],
data: V2TimRecvGroupCustomMessage.fromJson(json['data']) as T,
);
} else if (T == V2TimMessage) {
return V2TimEventCallback(
type: json['type'],
data: V2TimMessage.fromJson(json['data']) as T,
);
} else if (T.toString() == "List<V2TimMessageReceipt>") {
return V2TimEventCallback(
type: json['type'],
data: (json['data'] as List)?.map((e) {
return V2TimMessageReceipt.fromJson(e);
})?.toList() as T,
);
} else if (T.toString() == 'List<V2TimFriendApplication>') {
return V2TimEventCallback(
type: json['type'],
data: (json['data'] as List)?.map((e) {
return V2TimFriendApplication.fromJson(e);
})?.toList() as T,
);
} else if (T.toString() == 'List<String> ') {
return V2TimEventCallback(
type: json['type'],
data: (json['data'] as List)?.map((e) {
return e;
})?.toList() as T,
);
} else if (T.toString() == 'List<V2TimFriendInfo>') {
return V2TimEventCallback(
type: json['type'],
data: (json['data'] as List)?.map((e) {
return V2TimFriendInfo.fromJson(e);
})?.toList() as T,
);
} else if (T.toString() == 'List<V2TimConversation>') {
return V2TimEventCallback(
type: json['type'],
data: (json['data'] as List)?.map((e) {
return V2TimConversation.fromJson(e);
})?.toList() as T,
);
}
return V2TimEventCallback(
type: json['type'],
data: json['data'],
);
}