Request constructor

Request({
  1. required String method,
  2. required Uri url,
  3. required Headers headers,
  4. required Stream<List<int>> bodyStream,
  5. Map<String, String>? params,
  6. DVPeerAddress? peerAddress,
  7. DVPeerAddress? peerAddressOf()?,
})

peerAddress is the address itself; peerAddressOf reads it the first time peerAddress is asked for, for a server that has it as text and would otherwise parse it for every request, most of which never look. Given both, peerAddressOf wins.

Implementation

Request({
  required this.method,
  required this.url,
  required this.headers,
  required Stream<List<int>> bodyStream,
  Map<String, String>? params,
  DVPeerAddress? peerAddress,
  DVPeerAddress? Function()? peerAddressOf,
})  : _peerAddress = peerAddress,
      _peerAddressOf = peerAddressOf,
      params = params == null
          ? <String, String>{}
          : Map<String, String>.from(params),
      body = Body(bodyStream);