我正在开发 flutter 网络应用程序并试图从互联网上获取一些数据
我正在使用包:http/http.dart
并尝试这样做:
await http.get(url);
但我收到了这个错误:
Unsupported operation: Platform._version
daz@daz:/rom/source/public/checkout_example$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, v1.16.2-pre.41, on Linux, locale en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[✓] Android Studio (version 3.6)
[!] IntelliJ IDEA Community Edition (version 2019.3)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] Connected device (3 available)
! Doctor found issues in 2 categories.
最佳答案
我相信你现在已经想通了,但我刚刚遇到了同样的问题并遇到了这篇文章。
所以,现在已经找到了解决方案,我想我会把它张贴在这里,以拯救下一个遇到它的人。
解决方法是更新http
的版本插件 pubspec.yaml
我一直在用 http: "0.11.3+17"
并得到那个错误。
我更新了 pubspec.yaml
中的条目至 http: ^0.12.1
它有效。
关于 flutter 网页 http.get 返回 "Unsupported operation: Platform._version",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59952087/