NIMMessage class
消息
- Implementers
- Annotations
-
- @JsonSerializable()
Constructors
-
NIMMessage({String? messageId, String? sessionId, NIMSessionType? sessionType, required NIMMessageType messageType, int? 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, String? yidunAntiSpamExt, String? yidunAntiSpamRes, NIMMessageRobotInfo? robotInfo}) - NIMMessage.audioEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, required int duration, String? displayName, String? base64, NIMNosScene nosScene = NIMNosScenes.defaultIm})
-
factory
- NIMMessage.customEmptyMessage({required String sessionId, required NIMSessionType sessionType, String? content, NIMMessageAttachment? attachment, NIMCustomMessageConfig? config})
-
创建自定义消息
factory
- NIMMessage.emptyMessage({required String sessionId, required NIMSessionType sessionType, required int timestamp})
-
factory
- NIMMessage.fileEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, String? base64, int? fileSize, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})
-
factory
-
NIMMessage.fromMap(Map<
String, dynamic> map) -
factory
- NIMMessage.imageEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, required int fileSize, String? displayName, String? base64, NIMNosScene nosScene = NIMNosScenes.defaultIm})
-
factory
- NIMMessage.locationEmptyMessage({required String sessionId, required NIMSessionType sessionType, required double latitude, required double longitude, required String address})
-
factory
- NIMMessage.textEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String text})
-
factory
- NIMMessage.tipEmptyMessage({required String sessionId, required NIMSessionType sessionType})
-
factory
- NIMMessage.videoEmptyMessage({required String sessionId, required NIMSessionType sessionType, required String filePath, int? fileSize, String? base64, required int duration, required int width, required int height, required String displayName, NIMNosScene nosScene = NIMNosScenes.defaultIm})
-
factory
Properties
- ackCount → int
-
群消息已读回执的已读数
final
- antiSpamOption ↔ NIMAntiSpamOption?
-
易盾反垃圾配置项
getter/setter pair
- attachmentStatus ↔ NIMMessageAttachmentStatus?
-
消息附件下载状态 仅针对收到的消息
getter/setter pair
- callbackExtension → String?
-
第三方回调回来的自定义扩展字段
final
- clientAntiSpam ↔ bool
-
命中了客户端反垃圾,服务器处理
getter/setter pair
- config ↔ NIMCustomMessageConfig?
-
消息配置
getter/setter pair
- content ↔ String?
-
消息文本
消息中除
IMMessageType.text
和IMMessageType.tip
外,其他消息text
字段都为 nullgetter/setter pair - env ↔ String?
-
环境变量
用于指向不同的抄送,第三方回调等配置
注意:数据库不会保存此字段
getter/setter pair
- fromAccount ↔ String?
-
消息发送方帐号
getter/setter pair
- fromNickname → String?
-
消息发送方昵称
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasSendAck → bool
-
是否已经发送过群消息已读回执
final
- isChecked ↔ bool
-
消息的选中状态
getter/setter pair
- isDeleted → bool
-
消息是否标记为已删除
已删除的消息在获取本地消息列表时会被过滤掉,只有根据 messageId
获取消息的接口可能会返回已删除消息。聊天室消息里,此字段无效。
final
- isInBlackList → bool
-
发送消息给对方, 是不是被对方拉黑了(消息本身是发送成功的)
final
- isRemoteRead ↔ bool?
-
判断自己发送的消息对方是否已读
只有当当前消息为 NIMSessionType.p2p 消息且 NIMMessageDirection.outgoing 为
true
getter/setter pair -
localExtension
↔ Map<
String, dynamic> ? -
本地扩展字段(仅本地有效)
getter/setter pair
- memberPushOption ↔ NIMMemberPushOption?
-
指定成员推送选项
getter/setter pair
- messageAck ↔ bool
-
是否需要消息已读(主要针对群消息)
getter/setter pair
- messageAttachment ↔ NIMMessageAttachment?
-
消息附件内容
getter/setter pair
- messageDirection ↔ NIMMessageDirection
-
发送消息或者接收到消息
getter/setter pair
- messageId → String?
-
消息ID,唯一标识
final
- messageSubType ↔ int?
-
消息子类型,小于等于0表示没有子类型
getter/setter pair
- messageThreadOption ↔ NIMMessageThreadOption?
-
消息的thread信息
getter/setter pair
- messageType → NIMMessageType
-
消息类型
final
- pushContent ↔ String?
-
消息推送文案,长度限制200字节
getter/setter pair
-
pushPayload
↔ Map<
String, dynamic> ? -
消息推送Payload
@discussion iOS 上支持字段参考苹果技术文档,长度限制 2K,撤回消息时该字段无效
getter/setter pair
- quickCommentUpdateTime → int?
-
快捷评论的最后更新时间 (SDK内部使用,不建议用户使用)
final
-
remoteExtension
↔ Map<
String, dynamic> ? -
消息拓展字段
服务器下发的消息拓展字段,并不在本地做持久化,目前只有聊天室中的消息才有该字段
getter/setter pair
- robotInfo ↔ NIMMessageRobotInfo?
-
机器人消息
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- senderClientType → NIMClientType?
-
发送者客户端类型
final
- serverId → int?
-
消息 ServerID
final
- sessionId → String?
-
会话ID,如果当前session为team,则sessionId为teamId,如果是P2P则为对方帐号
final
- sessionType → NIMSessionType?
-
会话类型,当前仅支持P2P,Team和Chatroom
final
- sessionUpdate ↔ bool
-
消息是否需要刷新到session服务
只有消息存离线的情况下,才会判断该参数,默认:是
getter/setter pair
- status ↔ NIMMessageStatus?
-
消息状态
getter/setter pair
- timestamp → int
-
消息发送时间
本地存储消息可以通过修改时间戳来调整其在会话列表中的位置,发完服务器的消息时间戳将被服务器自动修正
final
- unAckCount → int
-
群消息已读回执的未读数
final
- uuid → String?
-
消息UUID
final
-
yidunAntiCheating
↔ Map<
String, dynamic> ? -
易盾反垃圾增强反作弊专属字段
getter/setter pair
- yidunAntiSpamExt ↔ String?
-
易盾反垃圾扩展字段,为 json
getter/setter pair
- yidunAntiSpamRes ↔ String?
-
易盾反垃圾返回的结果
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited