complete method

void complete(
  1. JsonRpcResponse<T> response
)

Completes the WebSocketExchange with a response.

Implementation

void complete(final JsonRpcResponse<T> response) {
  if (!_completer.isCompleted) {
    if (id == response.id) {
      _completer.complete(response);
    } else {
      completeError(WebSocketException(
        'Invalid `response` passed to [WebSocketExchange.complete].\n'
        'The response.id ${response.id} does not match the request.id $id.'
      ));
    }
  }
}