解决:其实 Flutter 的 “hot reload” 技术虽然为我们的开发提供了极大的便利,但它也不是万能的。 我们新添加的插件包就无法直接通过热重载打入手机应用包中,有的人会尝试直接点击绿色向右小三角安装,这样也是无法实现重新编译打包安装到手机的,这个时候你必须停止掉应用(红色小正方形按钮),再重新点击安装才行。
————————————————
原文链接:https://blog.csdn.net/haha223545/article/details/90409334
解决:报错原因为请求数据时使用async、await,返回是一个Future对象,相对于前端的promise对象。
————————————————
原文链接:https://blog.csdn.net/qq_39081974/article/details/100114800
D:\gitlab\Flutter\yujianlife\yujianlife\android\gradlew.bat exited abnormally. Try rerunning with ‘-v’ for more infomration, or check the gradlew script above for
errors.
ProcessException: Process exited abnormally:
Error occurred during initialization of VM
Unable to allocate 130560KB bitmaps for parallel garbage collection for the requested 4177920KB heap.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Command: D:\gitlab\Flutter\yujianlife\yujianlife\android\gradlew.bat -v
解决:关掉fanqiang软件(把小飞机关了,就能正常运行了…)。
解决:
}).catchError((Exception error) {
has to be
}).catchError((Object error) {
You can’t limit to Exception here. Dart can throw all kinds of values.
https://stackoverflow.com/questions/55268266/what-is-wrong-with-this-dart-error-handler
I/flutter (32227): The following assertion was thrown building TextField(controller:
I/flutter (32227): TextEditingController#489bd(TextEditingValue(text: ┤15201417937├, selection:
I/flutter (32227): TextSelection(baseOffset: -1, extentOffset: -1, affinity: TextAffinity.downstream, isDirectional:
I/flutter (32227): false), composing: TextRange(start: -1, end: -1))), decoration: InputDecoration(icon:
I/flutter (32227): Icon(IconData(U+0E0CD)), hintText: “请输入用户名”), textDirection: ltr, dirty, state:
I/flutter (32227): _TextFieldState#e9fff):
I/flutter (32227): No Directionality widget found.
I/flutter (32227): TextField widgets require a Directionality widget ancestor.
I/flutter (32227): The specific widget that could not find a Directionality ancestor was:
I/flutter (32227): TextField
I/flutter (32227): The ownership chain for the affected widget is: “TextField ← Column ← Padding ← Semantics ←
I/flutter (32227): DefaultTextStyle ← AnimatedDefaultTextStyle ← _InkFeatures-[GlobalKey#0f2ae ink renderer] ←
I/flutter (32227): NotificationListener ← CustomPaint ← _ShapeBorderPaint ← ⋯”
I/flutter (32227): Typically, the Directionality widget is introduced by the MaterialApp or WidgetsApp widget at the
I/flutter (32227): top of your application widget tree. It determines the ambient reading direction and is used, for
I/flutter (32227): example, to determine how to lay out text, how to interpret “start” and “end” values, and to resolve
I/flutter (32227): EdgeInsetsDirectional, AlignmentDirectional, and other *Directional objects.
解决:
// runApp(MyApp());
runApp(MaterialApp(home: MyApp()));
使用脚手架Scaffold可以设置AppBar,想要设置高度,在AppBar外包一层PreferredSize,设置preferredSize的属性为想要的高度即可。
Scaffold(
appBar: PreferredSize(
child: AppBar(
),
preferredSize: Size.fromHeight(screenSize.height * 0.07))
);