ChatThreadEvent.fromJson constructor
ChatThreadEvent.fromJson( - Map map
)
Implementation
factory ChatThreadEvent.fromJson(Map map) {
String from = map["from"];
int iType = map["type"];
ChatThreadOperation type = ChatThreadOperation.UnKnown;
switch (iType) {
case 0:
type = ChatThreadOperation.UnKnown;
break;
case 1:
type = ChatThreadOperation.Create;
break;
case 2:
type = ChatThreadOperation.Update;
break;
case 3:
type = ChatThreadOperation.Delete;
break;
case 4:
type = ChatThreadOperation.Update_Msg;
break;
}
ChatThread? chatThread = map.getValue<ChatThread>(
"thread",
callback: (map) {
if (map == null) {
return null;
}
return ChatThread.fromJson(map);
},
);
return ChatThreadEvent._private(
type: type,
from: from,
chatThread: chatThread,
);
}