fetchChatThreadMembers method

Future<List<String>> fetchChatThreadMembers(
  1. {required String chatThreadId,
  2. String? cursor,
  3. int limit = 20}
)

Paging to get Chat Thread members.

The members of the group to which Chat Thread belongs have permission.

Param chatThreadId Chat Thread ID.

Param cursor The initial value can be empty or empty string.

Param limit The number of fetches at one time. Value range 1, 50.

Return The result of ChatCursorResult, including the cursor for getting data next time and the chat thread member list.

Throws A description of the exception. See ChatError.

Implementation

Future<List<String>> fetchChatThreadMembers({
  required String chatThreadId,
  String? cursor,
  int limit = 20,
}) async {
  Map req = {
    "pageSize": limit,
    "threadId": chatThreadId,
  };
  req.putIfNotNull("cursor", cursor);
  Map result = await _channel.invokeMethod(
    ChatMethodKeys.fetchChatThreadMember,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    List<String> list = [];
    result[ChatMethodKeys.fetchChatThreadMember]?.forEach((element) {
      if (element is String) {
        list.add(element);
      }
    });
    return list;
  } on ChatError catch (e) {
    throw e;
  }
}