setStatus method

Future<VIStatusEvent> setStatus(
  1. bool online
)

Set the current user status.

Other users (that are subscribed to the user) and other clients (of the current user) can be informed about the status changing via the VIMessenger.onSetStatus

online - True if user is available for messaging, false otherwise

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

Implementation

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