NIMChatroomNotificationAttachment.createChatroomNotificationAttachment constructor Null safety

NIMChatroomNotificationAttachment.createChatroomNotificationAttachment(
  1. Map<String, dynamic> map
)

Implementation

factory NIMChatroomNotificationAttachment.createChatroomNotificationAttachment(
    Map<String, dynamic> map) {
  final int type = map['type'] as int;
  switch (type) {
    case NIMChatroomNotificationTypes.chatRoomMemberIn:
      return NIMChatroomMemberInAttachment.fromMap(map);
    case NIMChatroomNotificationTypes.chatRoomMemberTempMuteAdd:
    case NIMChatroomNotificationTypes.chatRoomMemberTempMuteRemove:
      return NIMChatroomTempMuteAttachment.fromMap(map);
    case NIMChatroomNotificationTypes.chatRoomQueueBatchChange:
    case NIMChatroomNotificationTypes.chatRoomQueueChange:
      return NIMChatroomQueueChangeAttachment.fromMap(map);
    default:
      return NIMChatroomNotificationAttachment.fromMap(map);
  }
}