Request<T> constructor Null safety

Request<T>(
  1. {required Uri url,
  2. required String method,
  3. required Map<String, String> headers,
  4. Stream<List<int>>? bodyBytes,
  5. bool followRedirects = true,
  6. int maxRedirects = 4,
  7. int? contentLength,
  8. FormData? files,
  9. bool persistentConnection = true,
  10. Decoder<T>? decoder}
)

Implementation

factory Request({
  required Uri url,
  required String method,
  required Map<String, String> headers,
  Stream<List<int>>? bodyBytes,
  bool followRedirects = true,
  int maxRedirects = 4,
  int? contentLength,
  FormData? files,
  bool persistentConnection = true,
  Decoder<T>? decoder,
}) {
  if (followRedirects) {
    assert(maxRedirects > 0);
  }
  return Request._(
    url: url,
    method: method,
    bodyBytes: bodyBytes ??= BodyBytesStream.fromBytes(const []),
    headers: Map.from(headers),
    followRedirects: followRedirects,
    maxRedirects: maxRedirects,
    contentLength: contentLength,
    files: files,
    persistentConnection: persistentConnection,
    decoder: decoder,
  );
}