在该build方法的第一行,生成此分析器警告

A value of type 'Listenable' can't be assigned to a variable of type 'Animation<double>'.
Try changing the type of the variable, or casting the right-hand type to 'Animation<double>'.
dart(invalid_assignment)

应该修改为:

final Animation<double> animation = listenable as Animation<double>;

有bug的代码:

class AnimatedLogo extends AnimatedWidget {AnimatedLogo({Key? key, required Animation<double> animation}): super(key: key, listenable: animation);@overrideWidget build(BuildContext context) {final Animation<double> animation = listenable;return new Center(child: new Container(margin: new EdgeInsets.symmetric(vertical: 10.0),height: animation.value,width: animation.value,child: new FlutterLogo(),));}
}

修改后的代码:

class AnimatedLogo extends AnimatedWidget {AnimatedLogo({Key? key, required Animation<double> animation}): super(key: key, listenable: animation);@overrideWidget build(BuildContext context) {final Animation<double> animation = listenable as Animation<double>;return new Center(child: new Container(margin: new EdgeInsets.symmetric(vertical: 10.0),height: animation.value,width: animation.value,child: new FlutterLogo(),));}
}

Flutter The argument type ‘Listenable‘ can‘t be assigned to the parameter type ‘Animation<double>相关推荐

  1. Flutter 转 null safe时报错: The argument type ‘Object‘ can‘t be assigned to the parameter type XXX

    在将Flutter工程转为 null safe的时候,遇到下面的错误: error: The argument type 'Object' can't be assigned to the param ...

  2. [futter错误]The argument type ‘String?‘ can‘t be assigned to the parameter type ‘String‘

    Change the return type of statusCode to String and provide a default value. String get statusCode =& ...

  3. error: The argument type ‘Function‘ can‘t be assigned to the parameter type ‘void Function()‘.

    出错的代码如下: 解决方案: 声明部分的写法改为: final void Function() onTap;

  4. vue3 router.push 传参路由跳转错误提示 Argument type {xxx} is not assignable to parameter type RouteLocationRaw

    文章目录 问题描述 解决方法 问题描述 传参时,router.push中布尔值变量会给出一个错误提示 setup(){const router = useRouter();/** 查看已办任务的流程记 ...

  5. swagger Illegal DefaultValue null for parameter type integer

    Swagger2异常:Illegal DefaultValue null for parameter type integer java 一.异常分析: Illegal DefaultValue nu ...

  6. SAP WM 采购订单收货后LT06报错-No bin types have been assigned to storage unit type IP-

    SAP WM 采购订单收货后LT06报错-No bin types have been assigned to storage unit type IP- 1,如下的storage type Z03, ...

  7. 解决 Illegal DefaultValue null for parameter type integer 异常

    该异常是由 swagger 引起的 swagger 版本 1.9.2 解决原因:重新导入 swagger-annotations 和 swagger-models 版本 为 1.5.21 pom.xm ...

  8. Swagger2异常:Illegal DefaultValue null for parameter type integer java

    Swagger2异常:Illegal DefaultValue null for parameter type integer java 参考文章: (1)Swagger2异常:Illegal Def ...

  9. 成功解决Type Error: can‘t multiply sequence by non-int of type ‘float‘

    成功解决Type Error: can't multiply sequence by non-int of type 'float' 目录 解决问题 解决思路 解决方法 解决问题 File " ...

最新文章

  1. SAP MM里的ERS功能不适用于供应商寄售采购模式
  2. magento 让某个页面开启SSL访问
  3. 免费的SEO工具软件大全
  4. UVA 11557 - Code Theft (KMP + HASH)
  5. 大数据Hadoop2.x与Hadoop3.x相比较有哪些变化
  6. SSM后台框架下配合实现小程序图片上传至阿里云OOS
  7. 最长公共子序列php,动态规划(最长公共子序列LCS)
  8. C++基础——new与delete
  9. oracle数据文件5属于孤立,system数据文件问题库起不来,当家帮忙看看
  10. python 生意参谋_电商 Python 抓取 生意参谋-访客数据
  11. TikTok(国际版抖音)时间线
  12. 交换机基础知识 - 从零开始学习
  13. 微型机器学习,会是下一代AI革命吗?
  14. 创业公司 JPEGmini 可以将照片缩小5倍,但保证图片质量和分辨率
  15. CMD快捷指令之启动字符映射表
  16. airpods版本号_airpods蓝牙版本是多少,苹果AirPods正式版使用评测
  17. 夏普linux电视安装apk,夏普智能电视安装第三方应用看直播【最新教程】
  18. 电源设计1【测试方法、LDO】
  19. html英文期刊参考文献,论文参考文献英文格式
  20. 单片机:中断系统控制二极管的亮灭

热门文章

  1. 《对不队》团队作业4—基于原型的团队项目需求调研与分析
  2. Linux无处不在!让我来告诉你它到底在哪!
  3. unity人物模型换装系统浅析
  4. 从相机空间到屏幕投影,期间发生了什么
  5. 《网易一千零一夜 - 互联网产品项目管理实战》读书笔记
  6. go 判断元素是否在slice_在Java中如何高效判断数组中是否包含某个元素
  7. CAD中怎么设置线宽?CAD图纸打印出来线条太粗怎么办?
  8. 第12节:RNN原理及numpy实现
  9. 跟着Code走,详解Symbian OS API调用过程
  10. ip rule 和 ip route