stream<T> method

Future<void> stream<T>(
  1. Stream<T> stream, {
  2. String contentType = 'application/octet-stream',
  3. Map<String, String>? headers,
  4. List<int> toBytes(
    1. T
    )?,
})

Streams any type of data to the client (convenience method).

Implementation

Future<void> stream<T>(
  Stream<T> stream, {
  String contentType = 'application/octet-stream',
  Map<String, String>? headers,
  List<int> Function(T)? toBytes,
}) async {
  await _body.stream(
    stream,
    contentType: contentType,
    headers: headers,
    toBytes: toBytes,
  );
  _sent = true;
}