download function

Future<void> download(
  1. String endpoint,
  2. File target
)

Download a File.

Implementation

Future<void> download(String endpoint, File target) async {
  final client = HttpClient();
  final request = await client.getUrl(Uri.parse(endpoint));
  final response = await request.close();
  await response.pipe(target.openWrite());
}