forgetRoom method

Future<void> forgetRoom(
  1. String roomId
)

This API stops a user remembering about a particular room.

In general, history is a first class citizen in Matrix. After this API is called, however, a user will no longer be able to retrieve history for this room. If all users on a homeserver forget a room, the room is eligible for deletion from that homeserver.

If the user is currently joined to the room, they must leave the room before calling this API.

roomId The room identifier to forget.

Implementation

Future<void> forgetRoom(String roomId) async {
  final requestUri = Uri(
    path: '_matrix/client/v3/rooms/${Uri.encodeComponent(roomId)}/forget',
  );
  final request = Request('POST', baseUri!.resolveUri(requestUri));
  request.headers['authorization'] = 'Bearer ${bearerToken!}';
  final response = await httpClient.send(request);
  final responseBody = await response.stream.toBytes();
  if (response.statusCode != 200) unexpectedResponse(response, responseBody);
  final responseString = utf8.decode(responseBody);
  final json = jsonDecode(responseString);
  return ignore(json);
}