// Copyright 2015 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.import'dart:async';import'dart:io';import'../globals.dart';/// Download a file from the given URL and return the bytes.Future<List<int>>fetchUrl(Uriurl)async{printTrace('Downloading $url.');HttpClienthttpClient=newHttpClient();HttpClientRequestrequest=awaithttpClient.getUrl(url);HttpClientResponseresponse=awaitrequest.close();printTrace('Received response statusCode=${response.statusCode}');if(response.statusCode!=200)thrownewException(response.reasonPhrase);BytesBuilderresponseBody=newBytesBuilder(copy:false);awaitfor(List<int>chunkinresponse)responseBody.add(chunk);returnresponseBody.takeBytes();}