英文:
Flutter, after upgrading to 3.10, "Future isn't a type"
问题
After upgrading flutter with flutter upgrade
to 3.10
All my (previously working) Futures stopped working. Every single future is underlined with red saying "Future isn't a type".
What can I do to fix this? Clearly Future hasn't been removed.
英文:
After upgrading flutter with flutter upgrade
to 3.10
All my (previously working) Futures stopped working. Every single future is underlined with red saying "Future isn't a type".
What can I do to fix this? Clearly Future hasn't been removed.
答案1
得分: 3
这也发生在我身上,升级到3.10后。
我正在使用VS Code。在用Android Studio打开后,我能够顺利构建它。
回到VS Code,它又开始正常工作了。 😊
英文:
This was happing to me too after upgrade to 3.10.
I am using VS Code. After opening with Android Studio, I was able to build it without any problem.
Going back to VS Code, and it starts to work again. 😃
答案2
得分: 1
只重新加载 VsCode 对我解决了问题。
英文:
Just reloading VsCode fixed the issue for me
答案3
得分: 0
add "import 'dart:async';" in your code and change "future" to "FutureOr"
英文:
add "import 'dart:async';" in your code and change "future" to "FutureOr"
答案4
得分: 0
一旦升级到 Flutter 3.10,请确保在 pubspec.yaml 文件中更改 Flutter SDK 环境版本。
从:
environment:
sdk: 'existing_version'
到:
environment:
sdk: '>=3.0.3 <4.0.0' //TODO: 更改版本
完成后运行:
flutter pub get
flutter pub upgrade
英文:
Once you upgrade to Flutter 3.10, make sure you change the Flutter SDK environment version in pubspec.yaml file
Change From:
environment:
sdk: 'existing_version'
To:
environment:
sdk: '>=3.0.3 <4.0.0' //TODO: Change Version
After this run,
flutter pub get
flutter pub upgrade
答案5
得分: -2
Flutter clean
Flutter pub get
我认为这对你会有用。
英文:
Flutter clean
Flutter pub get
I think that will work for You
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论