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