📜  如何在颤动中缓存视频 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:46.305000             🧑  作者: Mango

代码示例1
static var httpClient = new HttpClient();
Future _downloadFile(String url, String filename) async {
  var request = await httpClient.getUrl(Uri.parse(url));
  var response = await request.close();
  var bytes = await consolidateHttpClientResponseBytes(response);
  String dir = (await getApplicationDocumentsDirectory()).path;
  File file = new File('$dir/$filename');
  await file.writeAsBytes(bytes);
  return file;
}