19 lines
552 B
Dart
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}");
|
|
}
|
|
}
|
|
} |