getConversation method
~english Gets the conversation by conversation ID and conversation type.
Param conversationId The conversation ID.
Param type The conversation type: EMConversationType.
Param createIfNeed Whether to create the conversation if the conversation is not found:
- (Default)
true: Yes. false: No.
Return The conversation object found according to the conversation ID and type. The SDK returns null if the conversation is not found.
Throws A description of the exception. See EMError.
~end
~chinese 根据指定会话 ID 和会话类型获取会话对象。
没有找到会返回空值。
Param conversationId 会话 ID。
Param type 会话类型,详见 EMConversationType。
Param createIfNeed 没找到相应会话时是否自动创建。
- (默认)
true表示自动创建会话。 false表示不创建会话。
Return 根据指定 ID 以及会话类型找到的会话对象,如果没有找到会返回空值。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 EMError。
~end
Implementation
Future<EMConversation?> getConversation(
String conversationId, {
EMConversationType type = EMConversationType.Chat,
bool createIfNeed = true,
}) async {
return Client.instance.chatManager.getConversation(conversationId,
type: type, createIfNeed: createIfNeed);
}