在该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. [memcached] 2. 高级应用
  2. 分页存储过程(使用row_number()) Sql Server
  3. 本周ASP.NET英文技术文章推荐[06/03 - 06/09]
  4. 基于线性SVM的CIFAR-10图像集分类
  5. python备份发包脚本_Python备份脚本,python
  6. TCP与UDP在socket编程中的区别
  7. linux 网络块存储,网络存储集群
  8. 芯片老化验证流程_IC老化测试
  9. 腾讯QQ认证空间4月27日已全面开放申请,欲进军自媒体
  10. iOS图像处理——人脸识别
  11. python矩阵连乘_python动态规划解决矩阵连乘
  12. win10 linux双系统卸载,win10双系统卸载ubuntu的方法
  13. 随机森林 Iris 特征重要性
  14. apachecn归档下载
  15. 电脑重装系统蓝屏详细解决方法分享
  16. 原子物理与原子核物理知识结构(含链接)
  17. “盲盒抽奖”创意营销活动实践
  18. 北大清华真的是“掐尖”了吗?
  19. 高等数学复习之导数的运算(等价无穷小替换)
  20. 资源者、配置者、投资人

热门文章

  1. 报名 | 2018 TOKENSKY区块链大会-首尔站
  2. 想快速给文件夹重命名就这样做
  3. DA14580 主机从扫描到建立连接全过程分析(含代码)
  4. ftp上传下载文件详解
  5. 吉里吉里2 2.28 rev3发布
  6. 跨平台获取外部系统的数据解析成json并传输到前台展示成列表
  7. Array SSL客户端下载安装——您的浏览器没有获得Java Virtual Machine(JVM)支持。可能由于没有安装JVM或者已安装但是没有启用。请安装JVM1.5或者以上版本
  8. linux X配置文件,Linux和Windows互传文件 用户配置文件和密码配置文件 用户组管理 用户管理...
  9. PHP goto语句加密的解密全过程(实战)
  10. Python——lambda函数基本用法