fetchChatRoomAttributes method

Future<Map<String, String>?> fetchChatRoomAttributes(
  1. {required String roomId,
  2. List<String>? keys}
)

Gets the list of custom chat room attributes based on the attribute key list.

Param roomId The chat room ID.

Param keys The key list of attributes to get. If you set it as null or leave it empty, this method retrieves all custom attributes.

Return The chat room attributes in key-value pairs.

Throws A description of the exception. See ChatError.

Implementation

Future<Map<String, String>?> fetchChatRoomAttributes({
  required String roomId,
  List<String>? keys,
}) async {
  Map req = {
    "roomId": roomId,
  };

  if (keys != null) {
    req['keys'] = keys;
  }

  Map result = await _channel.invokeMethod(
    ChatMethodKeys.fetchChatRoomAttributes,
    req,
  );
  try {
    ChatError.hasErrorFromResult(result);
    return result[ChatMethodKeys.fetchChatRoomAttributes]
        ?.cast<String, String>();
  } on ChatError catch (e) {
    throw e;
  }
}