fetchGroupMembersInfo method

Future<ChatCursorResult<GroupMemberInfo>> fetchGroupMembersInfo({
  1. required String groupId,
  2. String? cursor,
  3. int limit = 20,
})

Gets the list of group members from the server.

Param groupId The group ID. Param cursor The pagination cursor. Pass null for the first call. Param limit The maximum number of members to fetch per page.

Returns ChatCursorResult containing group member list and next page cursor.

Throws Exception description, see ChatError.

Implementation

Future<ChatCursorResult<GroupMemberInfo>> fetchGroupMembersInfo({
  required String groupId,
  String? cursor,
  int limit = 20,
}) async {
  try {
    Map req = {
      "groupId": groupId,
      "limit": limit,
    };

    req.putIfNotNull('cursor', cursor);

    Map result = await platform_interface.Client.instance.groupManager.callNativeMethod(
      ChatMethodKeys.fetchGroupMembersInfo,
      req,
    );
    ChatError.hasErrorFromResult(result);
    return ChatCursorResult<GroupMemberInfo>.fromJson(
        result[ChatMethodKeys.fetchGroupMembersInfo],
        dataItemCallback: (value) {
      return GroupMemberInfo.fromJson(value);
    });
  } catch (e) {
    rethrow;
  }
}