SystemMessage constructor

SystemMessage({
  1. int? messageId,
  2. SystemMessageType? type,
  3. String? fromAccount,
  4. String? targetId,
  5. int? time,
  6. SystemMessageStatus? status,
  7. String? content,
  8. String? attach,
  9. Object? attachObject,
  10. bool? unread,
  11. String? customInfo,
})

Implementation

SystemMessage(
    {this.messageId,
    this.type,
    this.fromAccount,
    this.targetId,
    this.time,
    this.status,
    this.content,
    this.attach,
    this.attachObject,
    this.unread,
    this.customInfo}) {
  if (attach != null) {
    switch (type) {
      case SystemMessageType.addFriend:
        final Map<String, dynamic> attachMap = JsonDecoder().convert(attach!);
        int verifyType = attachMap['vt'];
        Map<String, dynamic>? exMap = attachMap['serverex'];
        String? ext;
        if (exMap != null) {
          ext = exMap['0'] == 1 ? exMap['1'] : null;
        }
        attachObject = AddFriendNotify(
            fromAccount, getEventFromInt(verifyType),
            msg: content, serverExt: ext);
        break;
      default:
        break;
    }
  }
}