WallPaper_ZZH_Flutter/wallpaper/lib/utils/downloadmanager.dart
bluesea 6d393401c0 d
2024-05-14 12:03:09 +08:00

19 lines
552 B
Dart

import 'dart:io';
import 'package:flutter/foundation.dart';
class DownloadManager {
static Future<void> downloadImgWithUrl(String urlStr) async {
var httpClient = HttpClient();
try {
var reqiest = await httpClient.getUrl(Uri.parse(urlStr));
var response = await reqiest.close();
// var bytes = await consolidateHttpClientResponseBytes(response);
var bytes = await consolidateHttpClientResponseBytes(response);
print("the bytes:${bytes}");
}
catch(error) {
print("the error:${error}");
}
}
}