NIMMessage class Null safety


  • @JsonSerializable()


NIMMessage({String? messageId, String? sessionId, NIMSessionType? sessionType, required NIMMessageType messageType, NIMMessageType? messageSubType, NIMMessageStatus? status, required NIMMessageDirection messageDirection, String? fromAccount, String? content, required int timestamp, NIMMessageAttachment? messageAttachment, NIMMessageAttachmentStatus? attachmentStatus, String? uuid, int? serverId, NIMCustomMessageConfig? config, Map<String, dynamic>? remoteExtension, Map<String, dynamic>? localExtension, String? callbackExtension, Map<String, dynamic>? pushPayload, String? pushContent, NIMMemberPushOption? memberPushOption, NIMClientType? senderClientType, NIMAntiSpamOption? antiSpamOption, bool messageAck = false, bool hasSendAck = false, int ackCount = 0, int unAckCount = 0, bool clientAntiSpam = false, bool isInBlackList = false, bool isChecked = false, bool sessionUpdate = true, NIMMessageThreadOption? messageThreadOption, int? quickCommentUpdateTime, bool isDeleted = false, Map<String, dynamic>? yidunAntiCheating, String? env, String? fromNickname, bool? isRemoteRead})
NIMMessage.audioEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, required int duration, String? displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})
NIMMessage.customEmptyMessage({required String sessionId, required NIMSessionType sessionType, String? content, NIMMessageAttachment? attachment, NIMCustomMessageConfig? config})
Create a custom message
NIMMessage.emptyMessage({required String sessionId, required NIMSessionType sessionType, required int timestamp})
NIMMessage.fileEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, int? fileSize, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})
NIMMessage.fromMap(Map<String, dynamic> map)
NIMMessage.imageEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, String? displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})
NIMMessage.locationEmptyMessage({required String sessionId, required NIMSessionType sessionType, required double latitude, required double longitude, required String address})
NIMMessage.textEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String text})
NIMMessage.tipEmptyMessage({required String sessionId, required NIMSessionType sessionType})
NIMMessage.videoEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, int? fileSize, required int duration, required int width, required int height, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})


ackCount int
Get the read count of a group message
@JsonKey(defaultValue: 0), final
antiSpamOption NIMAntiSpamOption?
Fields for the GuardEase anti-spam configuration
@JsonKey(fromJson: NIMAntiSpamOption._fromMap, toJson: NIMAntiSpamOption._toMap), read / write
attachmentStatus NIMMessageAttachmentStatus?
Message attachment download states for received messages
@JsonKey(unknownEnumValue: NIMMessageAttachmentStatus.transferred), read / write
callbackExtension String?
Custom extension field returned by a third party callback
clientAntiSpam bool
hit by anti-spam rules on the client and handled on the server.
@JsonKey(defaultValue: false), read / write
config NIMCustomMessageConfig?
Message settings
@JsonKey(fromJson: NIMCustomMessageConfig._fromMap, toJson: NIMCustomMessageConfig._toMap), read / write
content String?
Message content The text field of messages types except IMMessageType.text and IMMessageType.tip is set to null.
read / write
env String?
The environment variable Used to point to different types of configurations for data sync and third-party callbacks. Note: the field will not be stored in the database.
read / write
fromAccount String?
Sender account
read / write
fromNickname String?
Sender nickname
hashCode int
The hash code for this object.
read-only, inherited
hasSendAck bool
Check the read receipt of a sent message.
@JsonKey(defaultValue: false), final
isChecked bool
the select state of a message
@JsonKey(defaultValue: false), read / write
isDeleted bool
Check whether the message is marked as deleted Deleted messages will be filtered out when getting the local message list, and only the interface that gets messages based on messageId may return deleted messages. In chat room messages, this field is invalid.
@JsonKey(defaultValue: false), final
isInBlackList bool
Check if the current user is added to the blocklist by the peer by sending a message. The message is received.
@JsonKey(defaultValue: false), final
isRemoteRead bool?
Check whether the message sent by the current user is read The current message is of NIMSessionType.p2p type and NIMMessageDirection.outgoing is set to true.
read / write
localExtension Map<String, dynamic>?
Local extension field effective in local environment.
@JsonKey(fromJson: castPlatformMapToDartMap), read / write
memberPushOption NIMMemberPushOption?
Push notifications for specified members.
@JsonKey(fromJson: NIMMemberPushOption._fromMap, toJson: NIMMemberPushOption._toMap), read / write
messageAck bool
Specify message receipt for group messages.
@JsonKey(defaultValue: false), read / write
messageAttachment NIMMessageAttachment?
Message attachment
@JsonKey(fromJson: NIMMessageAttachment._fromMap, toJson: NIMMessageAttachment._toMap), read / write
messageDirection NIMMessageDirection
Send or receive messages
@JsonKey(unknownEnumValue: NIMMessageDirection.outgoing), read / write
messageId String?
Unique message identifier
@JsonKey(defaultValue: '-1'), final
messageSubType NIMMessageType?
Message subtypes
@JsonKey(unknownEnumValue: NIMMessageType.undef), read / write
messageThreadOption NIMMessageThreadOption?
Thread information about a message.
@JsonKey(fromJson: NIMMessageThreadOption._fromMap, toJson: NIMMessageThreadOption._toMap), read / write
messageType NIMMessageType
Message types
@JsonKey(unknownEnumValue: NIMMessageType.undef, defaultValue: NIMMessageType.undef), final
pushContent String?
Notification content that can contain up to 200 characters.
read / write
pushPayload Map<String, dynamic>?
Push notification payload @discussion The field can contain a custom payload. For more information about supported fields, see the official Apple documentation on APNs. The payload can contain 2000 characters. This field is invalid if the message is recalled.
@JsonKey(fromJson: castPlatformMapToDartMap), read / write
quickCommentUpdateTime int?
The most recent update time of a quick comment.
remoteExtension Map<String, dynamic>?
Message extension field The message extension field sent by the server is not persisted locally. Only the messages in the chat room contain this field (NIMMessageChatroomExtension)
@JsonKey(fromJson: castPlatformMapToDartMap), read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
senderClientType NIMClientType?
Client type of a sender
@JsonKey(unknownEnumValue: NIMClientType.unknown), final
serverId int?
Message ServerID
sessionId String?
Session ID. If the current session type is team, use teamId as sessionId, and peer account for P2P type
sessionType NIMSessionType?
Session types. P2P, team, and chat room are supported
@JsonKey(unknownEnumValue: NIMSessionType.p2p), final
sessionUpdate bool
Option to update the session The parameter takes effect only if the message is saved when the user is offline. The default value is true
@JsonKey(defaultValue: true), read / write
status NIMMessageStatus?
Message status
@JsonKey(unknownEnumValue: NIMMessageStatus.sending), read / write
timestamp int
The time when a message was sent Messages stored locally can adjust its position in the session list by modifying the timestamp, and the timestamp of the message sent to the server will be automatically rectified on the server.
unAckCount int
Get the unread count of a group message
@JsonKey(defaultValue: 0), final
uuid String?
Message UUID
yidunAntiCheating Map<String, dynamic>?
Fields for GuardEase anti-spam
@JsonKey(fromJson: castPlatformMapToDartMap), read / write


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toMap() Map<String, dynamic>
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.