1 A nullable expression can't be used as an iterator in a for-in loop
2 The property 'title' can't be unconditionally accessed because the receiver can be 'null'.
---类似的前边加个英文感叹号就可以了,表示这个变量不能为空,可以为空的话,修改为?号.
如:
book!.title
for (var book in books!)
3 Error handling 'checkPlatformOverride' custom request: method not available: ext.flutter.platformOverride
----可能是虚拟机刚删除了app,重装时有冲突,将VS Code重启,试试。
4 should not be imported into a null safe library
这个包不支持空安全
5 Navigator operation requested with a context that does not include a Navigator.
路由问题,最好将路由放在一个无状态的组件中
Flutter Incorrect use of ParentDataWidget
组件用法有问题
6 Cannot lerp between "MaterialColor(primary value: Color(0xfff44336))" and "MaterialColor(primary value: Color(0xff2196f3))".
tween: Tween<Color>(begin: Colors.red, end: Colors.blue),
解决方式:
-
TweenAnimationBuilder<Color?>(
-
tween: ColorTween(begin: Colors.amber, end: _myColor),
7 Navigator operation requested with a context that does not include a Navigator.
无状态组件中不能有跳转Navigator
8 Android Studio (not installed))
运行 flutter config --android-studio-dir <directory>
设置你的 Android Studio 的安装目录
Failed to launch Nexus 6 API 29: Error: Emulator didn't connect within 60 seconds
The emulator process for AVD Nexus_6_API_29 was killed
碰到上面的两个错误,最快的方式感觉删除重建立一个,更快些
9 Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project.
在android manifest.xml中 activity节点下增加配置
<meta-data
android:name="flutterEmbedding"
android:value="2" />
10 Navigator.onGenerateRoute was null, but the route named "/" was referenced.
一个原因可能是导入包的错误,应为material,有时会错误导入了cuperi...
11 A GlobalKey was used multiple times inside one widget's child list.
可能原因为键中值的重用
12 I/FlutterActivityDelegate( 2747): onResume setting current activity to this
E/flutter ( 2747): [ERROR:flutter/shell/common/engine.cc(147)] Could not prepare to run the isolate.
E/flutter ( 2747): [ERROR:flutter/shell/common/engine.cc(112)] Engine not prepare and launch isolate.
E/flutter ( 2747): [ERROR:flutter/shell/platform/android/android_shell_holder.cc(138)] Could not launch engine in configuration.
Syncing files to device Android SDK built for x86...
原因:构造方法无 或没有main程序入口点
const NextPage({Key? key}) : super(key: key);//添加构造方法
13 Prefer const literals as parameters of constructors on @immutable classes.dart(prefer_const_literals_to_create_immutables)
前面加上const就可以了
14 gg 13:37:10
flutter 怎么解决 软键盘弹出来的时候,把BottomNavigationBar 也顶上来了啊?朋友们
resizeToAvoidBottomInset: false,