getSubscriptions method

Future<VISubscriptionEvent> getSubscriptions()

Get all current subscriptions, i.e., the list of users the current user is subscribed to.

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

Implementation

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