fetchSubscribedMembers method

Future<List<String>> fetchSubscribedMembers(
  1. {int pageNum = 1,
  2. int pageSize = 20}
)

Uses pagination to get a list of users whose presence states you have subscribed to.

Param pageNum The current page number, starting from 1.

Param pageSize The number of subscribed users on each page.

Return Which contains IDs of users whose presence states you have subscribed to. Returns null if you subscribe to no user's presence state.

Throws A description of the exception. See ChatError.

Implementation

Future<List<String>> fetchSubscribedMembers({
  int pageNum = 1,
  int pageSize = 20,
}) async {
  Map req = {'pageNum': pageNum, "pageSize": pageSize};
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.fetchSubscribedMembersWithPageNum, req);
  try {
    ChatError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.fetchSubscribedMembersWithPageNum]
        ?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on ChatError catch (e) {
    throw e;
  }
}