connect method

Future<void> connect(
  1. Uri uri, {
  2. void onError(
    1. Object,
    2. StackTrace?
    )?,
  3. int maxRetries = 5,
})

Sets the Dart Tooling Daemon connection to point to uri.

Before connecting to uri, if a current connection exists, then disconnect is called to close it.

If the connection fails, will retry with exponential backoff up to maxRetries.

Implementation

Future<void> connect(
  Uri uri, {
  void Function(Object, StackTrace?)? onError,
  int maxRetries = 5,
}) {
  // On explicit connections, we capture the connect function so that we
  // can call it again if [reconnect()] is called.
  final connectFunc = _lastConnectFunc =
      () => _connectImpl(uri, onError: onError, maxRetries: maxRetries);
  return connectFunc();
}