Remove Participant - Flutter
This feature in a room allows the room host or organizer to remove a participant from the room. This can be helpful in situations where a participant is causing a disturbance, is behaving inappropriately, or is not following room guidelines.
VideoSDK provide three ways to remove participant from room.
1. Using SDK
remove()
Remove participant allows removing participant while session is on-going. This can be helpful when moderation in particular room is required.
remove() returns a Future that throws a VideoSDKError if the request is refused, for example 4066 (REMOVE_PARTICIPANT_FAILED). Await it inside try/catch.
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:videosdk/videosdk.dart';
class ParticipantTile extends StatefulWidget {
final Participant participant;
const ParticipantTile({super.key, required this.participant});
@override
State<ParticipantTile> createState() => _ParticipantTileState();
}
class _ParticipantTileState extends State<ParticipantTile> {
@override
Widget build(BuildContext context) {
return ElevatedButton(
child: Text("Remove ${widget.participant.displayName}"),
onPressed: () async {
try {
await widget.participant.remove();
} on VideoSDKError catch (e) {
log("Could not remove ${widget.participant.displayName}: ${e.code} ${e.name}");
}
},
);
}
}
Events associated with remove
Following callbacks are received when a participant is removed from the room.
- Participant who was removed from the room will receive a callback on
roomLeftonRoomobject, with aLeaveReasonthat says why, for exampleLeaveReason.REMOVE_PEER. - All other remote participants will receive a callback
participantLeftwith theParticipantwho left and aLeaveReason.
2. Using VideoSDK Dashboard
- You can go the session page on VideoSDK Dashboard and select the room you can to remove a participant from.
- And then from the participants list you can remove any participant you want.
3. Using Rest API
- You can also remove the particular participant from the room using the REST API.
- To use this method, you should have the
sessionIdof the room andparticipantIdof the participant who is supposed to be removed.
API Reference
The API references for all the methods and events utilised in this guide are provided below.
Got a Question? Ask us on discord

