leaveConversation method

Future<VIConversationEvent> leaveConversation(
  1. String uuid
)

Make the current user to leave a conversation specified by the UUID.

It's possible only if the conversation is not a direct one (VIConversation.direct is false) After a successful method call the conversation's UUID will be added to VIUser.leaveConversationList.

Other parties of the conversation (online participants and logged in clients) can be informed about leaving the conversation via the VIMessenger.onEditConversation callback.

uuid - Conversation UUID

Throws VIException, if operation failed, otherwise returns VIConversationEvent instance. For all possible errors see VIMessagingError

Implementation

Future<VIConversationEvent> leaveConversation(String uuid) async {
  try {
    Map<String, dynamic>? data = await _methodChannel
        .invokeMapMethod('Messaging.leaveConversation', {'uuid': uuid});
    if (data == null) {
      _VILog._e('VIMessenger: leaveConversation: data was null, skipping');
      throw VIException(
        VIMessagingError.ERROR_INTERNAL,
        'VIMessenger:leaveConversation: data was null',
      );
    }
    return VIConversationEvent._fromMap(data);
  } on PlatformException catch (e) {
    throw VIException(e.code, e.message);
  }
}