ChatViewModel class

Inheritance
Implementers

Constructors

ChatViewModel(String conversationId, NIMConversationType conversationType, {bool showReadAck = true, NIMMessage? anchorMessage, int? findAnchorDate, ChatUIConfig? chatUIConfig, Future<NIMResult<int>>? conversationEntryFuture, QuickCommentListLoader? quickCommentListLoader, QuickCommentAdder? quickCommentAdder, QuickCommentRemover? quickCommentRemover, MessageListConnectivityChecker? messageListConnectivityChecker, MessageReactionConnectivityChecker? messageReactionConnectivityChecker, String? currentAccountIdProvider()?, @visibleForTesting bool initializeRuntime = true})

Properties

aiUserRequestSuccess ↔ int
getter/setter pair
chatTitle ↔ String
getter/setter pair
chatUIConfig ↔ ChatUIConfig?
getter/setter pair
contactInfo ↔ ContactInfo?
getter/setter pair
conversationEntryFuture → Future<NIMResult<int>>?
Future created when the chat page enters the conversation.
final
conversationId → String
final
conversationType → NIMConversationType
final
currentAccountId → String?
no setter
findAnchorDate ↔ int?
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
hasMoreForwardMessages ↔ bool
getter/setter pair
hasMoreNewerMessages ↔ bool
getter/setter pair
historyReadPositionCount ↔ int?
getter/setter pair
historyReadPositionCountTruncated ↔ bool
getter/setter pair
historyReadPositionDisplayCount → String
no setter
historyReadPositionLoading → bool
no setter
historyReadPositionState → HistoryReadPositionState
no setter
historyReadPositionTracker → HistoryReadPositionTracker
页面生命周期内冻结的最早未读消息状态和数量。
final
initListener ↔ bool
getter/setter pair
isLoading ↔ bool
getter/setter pair
isMultiSelected ↔ bool
getter/setter pair
isTyping ↔ bool
only for p2p
getter/setter pair
markP2PMessageReadReceiptTime ↔ int
getter/setter pair
messageList ↔ List<ChatMessage>
getter/setter pair
mute ↔ bool
getter/setter pair
newMessages ↔ List<ChatMessage>
getter/setter pair
p2pUserAccId → String?
no setter
receiptTime ↔ int
getter/setter pair
reeditMessage ↔ RevokedMessageInfo?
getter/setter pair
replyMessage ↔ ChatMessage?
getter/setter pair
revokeMessageId ↔ String?
getter/setter pair
routePendingNewMessageKey → String
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
scrollToEnd ← void Function()
no getter
selectedMessages → List<NIMMessage>
no setter
sessionId → String
no setter
showHistoryReadPosition → bool
no setter
showNewMessage ↔ bool
getter/setter pair
showReadAck ↔ bool
getter/setter pair
showWarningTips ↔ bool
getter/setter pair
subscriptions → List<StreamSubscription>
final
teamInfo ↔ NIMTeam?
getter/setter pair
translationLanguageRequestId ↔ String?
getter/setter pair
voiceFromSpeaker ↔ bool
getter/setter pair

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
addMessagePin(NIMMessage message, {String? ext}) → Future<NIMResult<void>>
addSelectedMessage(NIMMessage message) → void
添加选中的消息
beginHistoryReadPositionLocation() → Future<NIMResult<NIMMessage>?>
开始查询最早未读消息,调用方负责完成实际滚动。
beginLoadedHistoryReadPositionLocation() → NIMMessage?
Starts a location using the current page when it covers the unread edge.
checkAutoTranslateMessages([List<ChatMessage>? messages]) → Future<void>
clearFindAnchorDate() → void
滚动完成后清除定位锚点,防止 build 循环触发滚动
clearRoutePendingNewMessages() → void
collectMessage(ChatMessage message) → void
completeHistoryReadPositionLocation({required bool success}) → void
deleteMessage(ChatMessage message) → void
delete message
deleteMessageOneByOne() → void
逐条删除
dispose() → void
Discards any resources used by the object.
override
ensureQuickCommentsLoaded(Iterable<ChatMessage> messages) → Future<void>
批量加载消息表情快捷回复,已加载和加载中的消息不会重复请求
evaluateHistoryReadPositionTop(int createTime, {bool hasReachedHistoryStart = false}) → void
在消息列表稳定后上报顶部真实消息,用于决定入口是否可见。
fetchMoreMessage(NIMQueryDirection direction) → dynamic
filterForwardMessage(bool filter(NIMMessage)) → bool
finishHistoryReadPositionLoading() → void
Stops the progress indicator once the target is ready for scrolling.
forwardMessage(NIMMessage message, String conversationId, {String? postScript}) → void
forwardMessageOneByOne(String conversationId, {String? postScript, bool exitMultiMode = true}) → void
逐条转发 exitMultiMode 是否退出多选模式 postScript 转发后的附言 conversationId 转发的目标会话id
forwardTranslatedText(String text, String conversationId, {String? postScript}) → Future<void>
getAIMessages() → List<NIMAIModelCallMessage?>?
获取AI消息的上下文 仅对数字人单聊
getAnchor(NIMQueryDirection direction) → NIMMessage?
getMessageByRefer(NIMMessageRefer messageRefer) → Future<NIMResult<NIMMessage>>
Resolves the full message represented by a message reference.
getMessageReactionState(NIMMessage message) → MessageReactionState
获取指定消息的表情快捷回复状态
getMessageTranslationState(NIMMessage message) → MessageTranslationState?
getVoiceToTextState(NIMMessage message) → MessageVoiceToTextState?
handleQuickCommentNotificationForTest(NIMMessageQuickCommentNotification notification) → void
handleSendMessageResult(NIMResult<NIMSendMessageResult> result) → Future<void>
hideMessageTranslation(ChatMessage message) → Future<void>
initBaseData({bool updateTitle = true}) → Future<void>
initData({NIMMessage? anchorMessage}) → dynamic
initUserState(String accountId) → void
初始化用户在线状态
isAIUser() → bool
会话对象是否是数字人
isHistoryReadPositionTarget(NIMMessage message) → bool
isMessageTranslating(NIMMessage message) → bool
isSelectedMessage(NIMMessage message) → bool
是否是被选中的消息
isVoiceToTextConverting(NIMMessage message) → bool
loadHistoryReadPositionAnchor(NIMMessage anchor) → Future<bool>
为历史阅读位置入口加载目标消息,并返回目标是否可以进入列表。
loadMessageWithAnchor(NIMMessage anchor) → void
loadMessageWithAnchorDate(int date) → void
mergedMessageForward(String conversationId, {String? postScript, String? errorToast, bool exitMultiMode = true}) → void
合并转发 exitMultiMode 是否退出多选模式 postScript 转发后的附言 conversationId 转发的目标会话id errorToast 转发失败的提示
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
prepareForAnchorLoading({NIMMessage? visibleThrough}) → void
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
removeMessagePin(NIMMessage message, {String? ext}) → void
removeSelectedMessage(NIMMessage message) → void
移除选中的消息
removeSelectedMessages(List<NIMMessage> messages) → void
移除选中的消息
resendMessage(ChatMessage message, {NIMMessage? replyMsg}) → void
resetTyping() → void
revokeMessage(ChatMessage message) → Future<NIMResult<void>>
撤回消息
sendAudioMessage(String filePath, String? name, int duration, {NIMMessage? replyMsg}) → void
sendFileMessage(String filePath, String name, {NIMMessage? replyMsg, Uint8List? fileBytes}) → void
sendImageMessage(String filePath, String? name, int width, int height, {NIMMessage? replyMsg, String? imageType, Uint8List? fileBytes}) → void
sendInputNotification(bool isTyping) → void
sendLocationMessage(LocationInfo location) → void
sendMessage(NIMMessage message, {NIMMessage? replyMsg, NIMMessagePushConfig? pushConfig}) → void
发送消息最终实现 message 消息 replyMsg 回复消息 pushConfig 推送配置 aiAgent 消息发送的AI代理
sendMessageP2PReceipt(NIMMessage message) → void
sendTeamMessageReceipt(ChatMessage message) → void
sendTextMessage(String text, {NIMMessage? replyMsg, List<String>? pushList, AitContactsModel? aitContactsModel, String? title}) → void
sendVideoMessage(String videoPath, String? name, int duration, int width, int height, {NIMMessage? replyMsg, Uint8List? fileBytes}) → void
setChatRouteVisible(bool visible) → void
shouldHandleCurrentMessage(NIMMessage message) → bool
shouldHandleMessageRefer(NIMMessageRefer? messageRefer) → bool
srollToNewMessage({bool scrollToEnd = true}) → void
toggleMessageReaction(ChatMessage message, int index) → Future<NIMResult<void>>
切换当前账号对消息的指定表情快捷回复
toString() → String
A string representation of this object.
inherited
translateInputText(String sourceText, String language) → void
translateMessage(ChatMessage message, {MessageTranslationSource source = MessageTranslationSource.manual}) → Future<void>
updateContactInfo(ContactInfo? info) → void
更新对方的用户信息
updateP2PReceipt(List<NIMP2PMessageReadReceipt> receipts) → void
updateVoicePlayModel(bool isVoiceFromSpeaker) → void
更新语音消息的播放模式
voiceToTextMessage(ChatMessage message) → Future<void>

Operators

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

Constants

aiMessageSize → const int
logTag → const String
messageLimit → const int
messageReactionNetworkUnavailableCode → const int
表情快捷回复因网络不可用而未执行。
translatePromptKey → const String
translateTemperature → const double
typeState → const String