removeAttributes method

Future<Map<String, int>?> removeAttributes(
  1. String roomId,
  2. {required List<String> keys,
  3. bool force = false}
)

Removes custom chat room attributes.

Param roomId The chat room ID.

Param keys The keys of the custom chat room attributes to remove.

Param force Whether to remove the attributes with same key set by others.

Return failureKeys map is returned in key-value format, where the key is the attribute key and the value is the reason for the failure.

Throws A description of the exception. See ChatError.

Implementation

Future<Map<String, int>?> removeAttributes(
  String roomId, {
  required List<String> keys,
  bool force = false,
}) async {
  Map req = {
    "roomId": roomId,
    "keys": keys,
    "forced": force,
  };

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