getGroupWithId method
- String groupId
获取群组实例,如果不存在则创建。
Param groupId 群组 ID。
Return 群组实例。
Throws 如果有异常会在这里抛出,包含错误码和错误描述,详见 ChatError.
Implementation
Future<ChatGroup?> getGroupWithId(String groupId) async {
try {
Map req = {'groupId': groupId};
Map result = await platform_interface.Client.instance.groupManager
.callNativeMethod(ChatMethodKeys.getGroupWithId, req);
ChatError.hasErrorFromResult(result);
if (result.containsKey(ChatMethodKeys.getGroupWithId)) {
return ChatGroup.fromJson(result[ChatMethodKeys.getGroupWithId]);
} else {
return null;
}
} catch (e) {
rethrow;
}
}