StreamResponse.fromStrings constructor

StreamResponse.fromStrings(
  1. Stream<String> strings, {
  2. dynamic statusCode = 200,
  3. Map<String, dynamic>? headers,
  4. String? mimeType,
  5. String? charset,
  6. Encoding encoding = cnv.utf8,
  7. List<Cookie>? cookies,
})

Response that writes the strings to the response.

Implementation

factory StreamResponse.fromStrings(
  Stream<String> strings, {
  statusCode = 200,
  Map<String, dynamic>? headers,
  String? mimeType,
  String? charset,
  cnv.Encoding encoding = cnv.utf8,
  List<Cookie>? cookies,
}) {
  return StreamResponse(
    body: strings.transform(encoding.encoder),
    statusCode: statusCode,
    headers: headers,
    mimeType: mimeType,
    charset: charset,
    cookies: cookies,
  );
}