fetchChatRoomMembers method Null safety

Future<EMCursorResult<String>> fetchChatRoomMembers(
  1. String roomId,
  2. {String cursor = '',
  3. int pageSize = 200}
)

Gets the chat room member list.

Param roomId The chat room ID.

Param cursor The cursor position from which to start getting data.

Param pageSize The number of members per page.

Return The list of chat room members. See {@link EMCursorResult}. If EMCursorResult.cursor is an empty string (""), all data is fetched.

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

Implementation

Future<EMCursorResult<String>> fetchChatRoomMembers(
  String roomId, {
  String cursor = '',
  int pageSize = 200,
}) async {
  Map req = {"roomId": roomId, "pageSize": pageSize};
  req.setValueWithOutNull("cursor", cursor);
  Map result =
      await _channel.invokeMethod(ChatMethodKeys.fetchChatRoomMembers, req);
  try {
    EMError.hasErrorFromResult(result);
    return EMCursorResult<String>.fromJson(
        result[ChatMethodKeys.fetchChatRoomMembers],
        dataItemCallback: (obj) => obj);
  } on EMError catch (e) {
    throw e;
  }
}