ChatGroupManager class

The group manager class, which manages group creation and deletion, user joining and exiting the group, etc.

Constructors

ChatGroupManager.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

acceptInvitation(String groupId, String inviter) Future<ChatGroup>
Accepts a group invitation.
acceptJoinApplication(String groupId, String username) Future<void>
Approves a group join application. Only the group owner can call this method.
addAdmin(String groupId, String memberId) Future<void>
Adds a group administrator. Only the group owner can call this method.
addAllowList(String groupId, List<String> members) Future<void>
Adds members to the group allowlist. Only the group owner and admins can call this method.
addEventHandler(String identifier, ChatGroupEventHandler handler) → void
Adds the group event handler. After calling this method, you can handle for new group event when they arrive.
addMembers(String groupId, List<String> members, {String? welcome}) Future<void>
Invites users to join a group.
blockGroup(String groupId) Future<void>
Blocks group messages. The server will no longer send messages from this group to the user. The group owner cannot block group messages.
blockMembers(String groupId, List<String> members) Future<void>
Adds users to the group blocklist. Only the group owner can call this method.
changeGroupDescription(String groupId, String desc) Future<void>
changeGroupName(String groupId, String name) Future<void>
changeOwner(String groupId, String newOwner) Future<void>
Changes the group owner. Only the group owner can call this method.
clearAllGroupsFromLocal() Future<void>
Clears all groups of the current user from the local database.
clearEventHandlers() → void
Clear all group event handlers.
createGroup({String? groupName, String? avatarUrl, String? desc, List<String>? inviteMembers, String? inviteReason, required ChatGroupOptions options}) Future<ChatGroup>
Creates a group.
declineInvitation({required String groupId, required String inviter, String? reason}) Future<void>
Declines a group invitation.
declineJoinApplication(String groupId, String username, {String? reason}) Future<void>
Declines a group join application. Only the group owner can call this method.
destroyGroup(String groupId) Future<void>
Destroys a group. Only the group owner can call this method.
downloadGroupSharedFile({required String groupId, required String fileId, required String savePath}) Future<void>
Downloads group shared files.
fetchAllowListFromServer(String groupId) Future<List<String>>
Gets the group allowlist from the server.
fetchAnnouncementFromServer(String groupId) Future<String?>
Gets the group announcement from the server.
fetchBlockListFromServer(String groupId, {int pageSize = 200, int pageNum = 1}) Future<List<String>>
Gets the group blocklist from the server. Only the group owner and admins can call this method.
fetchGroupFileListFromServer(String groupId, {int pageSize = 200, int pageNum = 1}) Future<List<ChatGroupSharedFile>>
Gets the group shared file list from the server.
fetchGroupInfoFromServer(String groupId, {bool? fetchMembers}) Future<ChatGroup>
Fetches group details including group ID, name, description, basic settings, owner and admins.
fetchGroupMembersInfo({required String groupId, String? cursor, int limit = 20}) Future<ChatCursorResult<GroupMemberInfo>>
Gets the list of group members from the server.
fetchJoinedGroupCount() Future<int>
Gets the number of groups joined by the current user from the server.
fetchJoinedGroupsFromServer({int pageSize = 20, int pageNum = 0, bool needMemberCount = false, bool needRole = false}) Future<List<ChatGroup>>
Gets the groups joined by the current user from the server with pagination.
fetchMemberAttributes({required String groupId, String? userId}) Future<Map<String, String>>
Gets all custom attributes of a group member.
fetchMemberListFromServer(String groupId, {int pageSize = 200, String? cursor}) Future<ChatCursorResult<String>>
Gets the list of group members from the server with pagination.
fetchMembersAttributes({required String groupId, required List<String> userIds, List<String>? keys}) Future<Map<String, Map<String, String>>>
Gets custom attributes of multiple group members by attribute keys.
fetchMuteListFromServer(String groupId, {int pageSize = 200, int pageNum = 1}) Future<Map<String, int>>
Gets the group mute list from the server. Only the group owner and admins can call this method.
fetchPublicGroupsFromServer({int pageSize = 200, String? cursor}) Future<ChatCursorResult<ChatGroupInfo>>
Gets public groups within the specified range from the server.
getEventHandler(String identifier) ChatGroupEventHandler?
Get the group event handler.
getGroupWithId(String groupId) Future<ChatGroup?>
Gets the group instance, creates it if it does not exist.
getJoinedGroups() Future<List<ChatGroup>>
Gets all group information of the current user from the local cache.
inviterUser(String groupId, List<String> members, {String? reason}) Future<void>
Invites users to join a group.
isMemberInAllowListFromServer(String groupId) Future<bool>
Checks whether the current user is on the group allowlist.
isMemberInGroupMuteList(String groupId) Future<bool>
Checks whether the current user is in the group mute list.
joinPublicGroup(String groupId) Future<void>
Joins a public group. The group style should be ChatGroupStyle.PublicOpenJoin.
leaveGroup(String groupId) Future<void>
Leaves a group. The group owner cannot leave, only can destroy the group.
muteAllMembers(String groupId) Future<void>
Mutes all group members. Only the group owner and admins can call this method.
muteMembers(String groupId, List<String> members, {int duration = -1}) Future<void>
Mutes group members. Only the group owner and admins can call this method.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
removeAdmin(String groupId, String adminId) Future<void>
Removes a group administrator. Only the group owner can call this method.
removeAllowList(String groupId, List<String> members) Future<void>
Removes members from the group allowlist. Only the group owner and admins can call this method.
removeEventHandler(String identifier) → void
Remove the group event handler.
removeGroupSharedFile(String groupId, String fileId) Future<void>
Removes group shared files.
removeMemberAttributes({required String groupId, required List<String> keys, String? userId}) Future<void>
Removes group member custom attributes.
removeMembers(String groupId, List<String> members) Future<void>
Removes members from the group. Only the group owner can call this method.
requestToJoinPublicGroup(String groupId, {String? reason}) Future<void>
Requests to join a public group that requires approval. The group style should be PublicJoinNeedApproval.
setMemberAttributes({required String groupId, required Map<String, String> attributes, String? userId}) Future<void>
Set group member custom attributes.
toString() String
A string representation of this object.
inherited
unblockGroup(String groupId) Future<void>
Unblocks group messages.
unblockMembers(String groupId, List<String> members) Future<void>
Removes users from the group blocklist. Only the group owner can call this method.
unMuteAllMembers(String groupId) Future<void>
Unmutes all group members. Only the group owner and admins can call this method.
unMuteMembers(String groupId, List<String> members) Future<void>
Unmutes group members. Only the group owner and admins can call this method.
updateGroupAnnouncement(String groupId, String announcement) Future<void>
Updates the group announcement. Only the group owner and admins can call this method.
updateGroupAvatar({required String groupId, required String avatarUrl}) Future<ChatGroup>
Changes the group avatar. Only the group owner can call this method.
updateGroupDesc(String groupId, String desc) Future<void>
Changes the group description. Only the group owner can call this method.
updateGroupExtension(String groupId, String extension) Future<void>
Updates group extension information. Only the group owner can call this method.
updateGroupName(String groupId, String name) Future<void>
Changes the group name. Only the group owner can call this method.
uploadGroupSharedFile(String groupId, String filePath) Future<void>
Uploads group shared files.

Operators

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