getPublicConversations method

Future<VIConversationListEvent> getPublicConversations()

Get all public conversations (VIConversation.publicJoin is true).

It's possible to get all public conversations (UUIDs) that were created by:

  • the current user
  • other users of the same child account
  • users of the main Voximplant developer account

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

Implementation

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