Server constructor

Server(
  1. StreamChannel<String> channel, {
  2. ErrorCallback? onUnhandledError,
  3. bool strictProtocolChecks = true,
})

Creates a Server that communicates over channel.

Note that the server won't begin listening to requests until Server.listen is called.

Unhandled exceptions in callbacks will be forwarded to onUnhandledError. If this is not provided, unhandled exceptions will be swallowed.

If strictProtocolChecks is false, this Server will accept some requests which are not conformant with the JSON-RPC 2.0 specification. In particular, requests missing the jsonrpc parameter will be accepted.

Implementation

Server(StreamChannel<String> channel,
    {ErrorCallback? onUnhandledError, bool strictProtocolChecks = true})
    : this.withoutJson(
          jsonDocument.bind(channel).transform(respondToFormatExceptions),
          onUnhandledError: onUnhandledError,
          strictProtocolChecks: strictProtocolChecks);