40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
---
|
|
id: deleting_and_hiding_channel
|
|
sidebar_position: 13
|
|
title: Deleting And Hiding A Channel
|
|
---
|
|
|
|
Remove Channels By Deleting Or Hiding
|
|
|
|
### Deleting a Channel
|
|
|
|
You can delete a Channel using the delete method. This marks the channel as deleted and hides all the content.
|
|
|
|
```dart
|
|
await channel.delete();
|
|
```
|
|
|
|
Note: If you recreate this channel, it will show up empty. Recovering old messages is not currently supported via the Stream Chat API.
|
|
|
|
### Hiding a Channel
|
|
|
|
Hiding a channel will remove it from query channel requests for that user until a new message is added.
|
|
Please keep in mind that hiding a channel is only available to members of that channel.
|
|
|
|
Optionally you can also clear the entire message history of that channel for the user.
|
|
This way, when a new message is received, it will be the only one present in the channel.
|
|
|
|
```dart
|
|
// hides the channel until a new message is added there
|
|
await channel.hide();
|
|
|
|
// shows a previously hidden channel
|
|
await channel.show();
|
|
|
|
// hide the channel and clear the message history
|
|
await channel.hide(clearHistory: true);
|
|
```
|
|
|
|
Note: You can still retrieve the list of hidden channels using the { "hidden" : true } query parameter.
|
|
|