removeConnection method

Future<bool?> removeConnection(
  1. String url
)

Removes a specific XMR connection from the list of available connections.

This method sends a RemoveConnectionRequest to remove a node connection based on the provided URL.

Example:

await xmrConnectionsClient.removeConnection('node-url');
print('Connection removed.');

Returns:

  • A Future containing true if the connection is successfully removed.
  • null if an error occurs.

Implementation

Future<bool?> removeConnection(String url) async {
  if (!havenoChannel.isConnected) {
    throw DaemonNotConnectedException();
  }
  try {
    await havenoChannel.xmrConnectionsClient!
        .removeConnection(RemoveConnectionRequest(url: url));
    return true;
  } on GrpcError catch (e) {
    handleGrpcError(e);
  }
  return null;
}