ExternalInterface<R extends Request, S extends SuccessResponse> constructor

ExternalInterface<R extends Request, S extends SuccessResponse>(
  1. List<GatewayConnection<Gateway<DomainModel, Request, SuccessResponse, SuccessDomainInput>>> gatewayConnections
)

Implementation

ExternalInterface(List<GatewayConnection<Gateway>> gatewayConnections) {
  handleRequest();
  for (final connection in gatewayConnections) {
    final gateway = connection();
    gateway.transport = (request) async {
      final req = request as R;
      final requestCompleter = gateway is WatcherGateway
          ? _StreamRequestCompleter<R, S>(req, gateway.yieldResponse)
          : _RequestCompleter<R, S>(req);

      _requestController.add(requestCompleter);
      return requestCompleter.future;
    };
  }
}