Flutter开发中遇到的问题

Unhandled Exception: MissingPluginException(No implementation found for method launch on channel)

解决:其实 Flutter 的 “hot reload” 技术虽然为我们的开发提供了极大的便利,但它也不是万能的。 我们新添加的插件包就无法直接通过热重载打入手机应用包中,有的人会尝试直接点击绿色向右小三角安装,这样也是无法实现重新编译打包安装到手机的,这个时候你必须停止掉应用(红色小正方形按钮),再重新点击安装才行。
————————————————
原文链接:https://blog.csdn.net/haha223545/article/details/90409334

Instance of ‘ResultData’

解决:报错原因为请求数据时使用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软件(把小飞机关了,就能正常运行了…)。

arguments, and return a a valid result: Closure: () => Null

解决:

}).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): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY

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()));

Flutter——设置appBar的高度

使用脚手架Scaffold可以设置AppBar,想要设置高度,在AppBar外包一层PreferredSize,设置preferredSize的属性为想要的高度即可。

   Scaffold( 
        appBar: PreferredSize(
        child: AppBar(
        ),
        preferredSize: Size.fromHeight(screenSize.height * 0.07))
);

分享个返利程序,可以赚点零花钱。
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值