【发布时间】:2021-11-11 11:34:00
【问题描述】:
当我运行我的代码时,我收到以下错误,我的应用程序用于从 youtube 下载视频声音。
错误
调试服务监听 ws://127.0.0.1:57539/2eLyP6sNDkg=/ws XMLHttpRequest 错误。 TypeError:无法读取 null 的属性(读取“缩略图”) 在 YoutubeMP3._YoutubeMP3State.new.getInfo (http://localhost:62257/packages/utube_mp3/YoutubeMP3.dart.lib.js:507:40) 在getInfo.throw() 在 http://localhost:62257/dart_sdk.js:40652:38 在 _RootZone.runBinary (http://localhost:62257/dart_sdk.js:40508:58) 在 _FutureListener.thenAwait.handleError (http://localhost:62257/dart_sdk.js:35445:33) 在句柄错误(http://localhost:62257/dart_sdk.js:36033:51) 在 Function._propagateToListeners (http://localhost:62257/dart_sdk.js:36059:17) 在 _Future.new.[_completeError] (http://localhost:62257/dart_sdk.js:35905:23) 在 async._AsyncCallbackEntry.new.callback (http://localhost:62257/dart_sdk.js:35944:31) 在 Object._microtaskLoop (http://localhost:62257/dart_sdk.js:40808:13) 在 _startMicrotaskLoop (http://localhost:62257/dart_sdk.js:40814:13) 在 http://localhost:62257/dart_sdk.js:36279:9
函数获取信息
//
Future<void> getInfo() async {
insertBody(videoURL.text);
setState(() {
progress = "";
status = "Download";
downloadsuccess = false;
isDownloading = false;
isFetching = true;
fetchSuccess = false;
});
try {
var response = await http.post("https://www.y2mate.com/fr22",
body: body, headers: headers);
video = Result.convertResult(response.body);
setState(() {
isFetching = false;
fetchSuccess = true;
});
} catch (e) {
print(e.toString());
setState(() {
isFetching = true;
fetchSuccess = false;
});
}
print("${video.thumbnail}\n${video.audioName}\n${video.vid}\n${video.id}");
}
【问题讨论】:
-
试试我的回答here希望对你有帮助
-
谢谢,但还是不行
-
现在是什么问题
标签: flutter android-studio xmlhttprequest