serverConnected method

Future<bool> serverConnected({
  1. Duration? timeLimit,
})

Return a future that completes with a bool indicating whether a connection was successfully established with the server.

Implementation

Future<bool> serverConnected({Duration? timeLimit}) {
  var future = _connected.future;
  if (timeLimit != null) {
    future = future.timeout(timeLimit, onTimeout: () {
      onFailedToConnect();
      server.stop();
      return false;
    });
  }
  return future;
}