update method

Send conversation changes to the cloud. The sent changes are: title, public join flag and custom data.

Successful update will happen if a participant is the owner (VIConversationParticipant.isOwner is true).

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

Implementation

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