connect method

Future connect()

Implementation

Future connect() async {
  await disconnect();
  if (settings.remotePass != null) {
    // PRO PRESENTER REMOTE CLIENT
    remote = ProRemoteClient(this, settings);
    _remoteConnectionListener = remote!.connectionStatus.listen(connectionHandler);
  }

  // PRO PRESENTER STAGE DISPLAY CLIENT
  if (settings.sdPass != null) {
    sd = ProSDClient(settings);
    _sdConnectionListener = sd!.connectionStatus.listen(connectionHandler);
  }
  var futures = [sd?.connect(), remote?.connect()];

  // unwrap and wait for the futures to complete
  return Future.wait(futures.where((e) => e != null).map((e) => e!));
}