fromStream method Null safety

Future<Response> fromStream(
  1. StreamedResponse response
)

Creates a new HTTP response by waiting for the full body to become available from a StreamedResponse.

Implementation

static Future<Response> fromStream(StreamedResponse response) async {
  final body = await response.stream.toBytes();
  return Response.bytes(body, response.statusCode,
      request: response.request,
      headers: response.headers,
      isRedirect: response.isRedirect,
      persistentConnection: response.persistentConnection,
      reasonPhrase: response.reasonPhrase);
}