Client.withoutJson constructor

Client.withoutJson(
  1. StreamChannel _channel
)

Creates a Client that communicates using decoded messages over channel.

Unlike new Client, this doesn't read or write JSON strings. Instead, it reads and writes decoded maps or lists.

Note that the client won't begin listening to responses until Client.listen is called.

Implementation

Client.withoutJson(this._channel) {
  done.whenComplete(() {
    for (var request in _pendingRequests.values) {
      request.completer.completeError(StateError(
          'The client closed with pending request "${request.method}".'));
    }
    _pendingRequests.clear();
  }).catchError((_) {
    // Avoid an unhandled error.
  });
}