removePanelist function
Removes a participant from the panelist list.
Example:
await removePanelist(RemovePanelistOptions(
socket: socket,
participant: Participant(id: "123", name: "John"),
roomName: "room123",
member: "currentUser",
islevel: "2",
showAlert: (alert) => print(alert.message),
));
Implementation
Future<void> removePanelist(RemovePanelistOptions options) async {
// Only hosts can remove panelists
if (options.islevel != "2") {
options.showAlert?.call(
message: "Only the host can remove panelists",
type: "danger",
duration: 3000,
);
return;
}
options.socket.emitWithAck("removePanelist", {
'participantId': options.participant.id,
'participantName': options.participant.name,
'roomName': options.roomName,
}, ack: (response) {
if (response == null || response['success'] != true) {
final reason = response?['reason'] ?? 'Unknown error';
debugPrint('removePanelist failed: $reason');
options.showAlert?.call(
message: reason,
type: "danger",
duration: 3000,
);
}
});
}