unsubscribeFromAll method

Future<VISubscriptionEvent> unsubscribeFromAll()

Unsubscribe from all subscriptions.

Other logged in clients (of the current user) can be informed about the unsubscription via the VIMessenger.onSubscribe callback. User(s) specified in the 'users' parameter aren't informed about the unsubscription.

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

Implementation

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