editParticipants method
Edit participants permissions. It's possible only if the current user can manage other participants (VIConversationParticipant.canManageParticipants is true).
Duplicated users are ignored. Will cause VIException if at least one user does not exist or belong to the conversation.
Other parties of the conversation (online participants and logged in clients) can be informed about editing participants via the VIMessenger.onEditConversation callback.
participants
- List of VIConversationParticipant to be edited in the conversation. Shouldn't contain null(s), be null or empty list.
Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError
Implementation
Future<VIConversationEvent> editParticipants(
List<VIConversationParticipant> participants,
) async {
try {
Map<String, dynamic>? data =
await _methodChannel.invokeMapMethod('Messaging.editParticipants', {
'conversation': uuid,
'participants': participants.map((e) => e._toMap).toList(),
});
if (data == null) {
_VILog._e('VIConversation: editParticipants: data was null, skipping');
throw VIException(
VIMessagingError.ERROR_INTERNAL,
'VIConversation:editParticipants: data was null',
);
}
return VIConversationEvent._fromMap(data);
} on PlatformException catch (e) {
throw VIException(e.code, e.message);
}
}