callInvite method

Future<Map> callInvite(
  1. dynamic invitees,
  2. dynamic config
)

Implementation

Future<Map<dynamic, dynamic>> callInvite(
    dynamic invitees, dynamic config) async {
  Object _config = mapToJSObj(config);

  final result =
      await promiseToFuture(ZIM.getInstance()!.callInvite(invitees, _config))
          .catchError((e) {
    throw PlatformException(code: e.code.toString(), message: e.message);
  });

  Map _resultMap = jsObjectToMap(result);

  Map resultMap = {
    'callID': _resultMap['callID'],
    'info': {'timeout': _resultMap['timeout'], 'errorInvitees': []}
  };

  _resultMap['errorInvitees'].forEach((invite) {
    resultMap['info']['errorInvitees'].add({
      'userID': invite['userID'],
      'state': invite['state'] is int ? invite['state'] : invite['userState']
    });
  });

  return resultMap;
}