getUserByName method

Future<VIUserEvent> getUserByName(
  1. String username
)

Get information for the user specified by the Voximplant user name, e.g., 'username@appname.accname'.

It's possible to get any user of the main Voximplant developer account or its child accounts.

username - Voximplant user identifier

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

Implementation

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