fetchJoinedChatThreadsWithParentId method Null safety

Future<EMCursorResult<EMChatThread>> fetchJoinedChatThreadsWithParentId(
  1. {required String parentId,
  2. String? cursor,
  3. int limit = 20}
)

Paging to get the list of Chat Threads that the current user has joined the specified group from the server。

Param parentId The session id of the upper level of the sub-area

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

Param limit The number of fetches at one time. Value range (0, 50].

Return The result of {@link EMCursorResult}), including the cursor for getting data next time and the chat thread object list.

Throws A description of the exception. See {@link EMError}.

Implementation

Future<EMCursorResult<EMChatThread>> fetchJoinedChatThreadsWithParentId({
  required String parentId,
  String? cursor,
  int limit = 20,
}) async {
  Map req = {
    "parentId": parentId,
    "pageSize": limit,
  };
  req.setValueWithOutNull("cursor", cursor);
  Map result = await _channel.invokeMethod(
      ChatMethodKeys.fetchJoinedChatThreadsWithParentId, req);
  try {
    EMError.hasErrorFromResult(result);
    return EMCursorResult.fromJson(
        result[ChatMethodKeys.fetchJoinedChatThreadsWithParentId],
        dataItemCallback: (map) {
      return EMChatThread.fromJson(map);
    });
  } on EMError catch (e) {
    throw e;
  }
}