Files
stream-chat-flutter/docusaurus/docs/Flutter/stream_chat/channel_members.mdx
T
2021-06-23 12:38:18 +05:30

36 lines
881 B
Plaintext

---
id: channel_members
sidebar_position: 10
title: Channel Members
---
Manipulating Members In A Channel
### Adding & Removing Channel Members
Using the addMembers() method adds the given users as members, while removeMembers() removes them.
```dart
await channel.addMembers(["thierry", "josh"]);
await channel.removeMembers(["tommaso"]);
```
You can optionally include a message object that client-side SDKs will use to populate a system message.
This works for both add and remove members:
```dart
// using client-side client
await channel.addMembers(['tommaso'], Message(text: 'Tommaso joined'));
```
### Leaving a channel
It is possible for user to leave the channel without moderator-level permissions.
Make sure channel members have `RemoveOwnChannelMembership` permission.
```dart
// remove own channel membership
await channel.removeMembers(['my_user_id']);
```