错误:ClientException:XMLHttpRequest 错误。,
Uri uri = Uri.parse(getUrl); Uint8List byteTest =等待http.readBytes(uri);
http.Response 响应=等待http.get(getUrl as Uri); Uint8List byteTest = response.bodyBytes;
Uint8List 字节测试 = (等待 NetworkAssetBundle(Uri.parse(getUrl)).load(getUrl)) 。缓冲 .asUint8List();
你的问题不清楚。但我曾经遇到过类似的问题,并将 Uri.parse(url) 转换为 Uri.https(..),解决了我的 XMLHttpRequest 错误。
示例:
var uri = Uri.https('example.org', '/path', {'q': 'dart'});
print(uri); // https://example.org/path?q=dart
查看以下网页了解更多信息:
https://api.flutter.dev/flutter/dart-core/Uri/Uri.https.html