JMNormalMessage.fromJson constructor Null safety

JMNormalMessage.fromJson(
  1. Map json
)

Implementation

JMNormalMessage.fromJson(Map<dynamic, dynamic> json)
    : id = json['id'],
      createTime = json['createTime'],
      serverMessageId = json['serverMessageId'],
      isSend = json['isSend'],
      state = getEnumFromString(JMMessageState.values, json['state']),
      from = JMUserInfo.fromJson(json['from']),
      extras = json['extras'] {
  switch (json['target']['type']) {
    case 'user':
      target = JMUserInfo.fromJson(json['target']);
      break;
    case 'group':
      target = JMGroupInfo.fromJson(json['target']);
      break;
  }
}