flutter 错误整理

ios

1、 could not find included file 'Pods/Target Support Files/Pods-Runner/Pods-Runner.debu

根目录下执行:
flutter clean
flutter pub get
到ios 目录下执行:
pod install

2、/packages/flutter_tools/bin/xcode_backend.sh: No such file or directory

vs 运行不报错,Xcode编译错误,Generated.xcconfig 文件中flutter_root正确
porject-configurations-debug

3、 Flutter引用第三方库时报Automatically assigning platform ios with version 8.0 on target Runner

来源

解决办法:
修改项目里的ios/Podfile文件,
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '8.0' #增加的内容

4、 CocoaPods did not set the base configuration of your project because your project already has a custom config set

在这里插入图片描述

5、flutter常见报错 hasSize 为什么出现 解决办法

出现这个hasSize的报错的原因:

  • 父空间没有设置高度,子Widget需要占据尽可能多的地方
    如在一个没有高度的Container中,放一个ListView组件,父Widget需要知道子Widget的高度的情况 计算排布
    或者一个ListView 套一个ListView

解决方法:
1、给container一个高度,内部listView超出部分滑动。
2、设置内部的listView的属性,使其只展示,不滑动

ListView的属性

shrinkWrap: 是否包裹 true就是要包裹 默认是false
physics: 是否滚动 这样滚动条都看不见了
padding: 内边距

6、导入第三方出错,VSCode 飘红Target of URI doesn’t exist

flutter package get
//然后重启VSCode

7、更新Flutter 后,重新运行报错:no named parameter with the name “”(一个包内的变量)

flutter clean
flutter pub get
// 部分报可能需要更新包的版本

8、This requires the ‘non-nullable’ language feature to be enabled.

Try updating your pubspec.yaml to set the minimum SDK constraint to 2.12.0 or higher, and running ‘pub get’.
在这里插入图片描述

9、 Unhandled Exception: Looking up a deactivated widget’s ancestor is unsafe.

报错信息:

 Unhandled Exception: Looking up a deactivated widget's ancestor is unsafe.
    At this point the state of the widget's element tree is no longer stable. To safely refer to a widget's ancestor in its dispose() method, save a reference to the ancestor by calling inheritFromWidgetOfExactType() in the widget's didChangeDependencies() method.

原因: context 找不到上下文报错,多个dialog嵌套一个消失、另一个出现时,有这个报错
解决:this.context
在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值