anchor.diff:      }
   
       if (msg is SuccessResponse) {
  -      final completer = _pendingRequests[msg.requestId];
  -      completer?.complete(msg.response);
  -      _pendingRequests.remove(msg.requestId);
  +      final request = _pendingRequests.remove(msg.requestId);
  +      request?.completer.complete(msg.response);
       } else if (msg is ErrorResponse) {
         final requestId = msg.requestId;
  -      final completer = _pendingRequests[requestId];
  +      final request = _pendingRequests.remove(requestId);
         final backgroundTrace = msg.stackTrace != null
             ? StackTrace.fromString(msg.stackTrace!)
             : null;
  -      final foregroundTrace = _requestTraces[requestId];
  -
  -      completer?.completeError(
  -          DriftRemoteException._(msg.error, backgroundTrace), foregroundTrace);
  +
  +      request?.completeWithError(
  +          DriftRemoteException._(msg.error, backgroundTrace));
         _pendingRequests.remove(msg.requestId);
       } else if (msg is Request) {
         _incomingRequests.add(msg);
       } else if (msg is CancelledResponse) {
  -      final completer = _pendingRequests[msg.requestId];
  -      completer?.completeError(const CancellationException());
  +      final request = _pendingRequests.remove(msg.requestId);
  +
  +      request?.completeWithError(const CancellationException());
       }
     }
   
  
positive.code:   }
  }
  
  /// Exception thrown when there are outstanding pending requests at the time the
  /// isolate connection was cancelled.
  class ConnectionClosedException implements Exception {
  
negative.code:     final id = requestId ?? newRequestId();
      final completer = Completer<T>();
  
      _pendingRequests[id] = _PendingRequest(completer, StackTrace.current);
  
      _send(Request(id, request));
      return completer.future;
  