Flutter The argument type ‘Listenable‘ can‘t be assigned to the parameter type ‘Animation<double>
在该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>相关推荐
- 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 ...
- [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 =& ...
- error: The argument type ‘Function‘ can‘t be assigned to the parameter type ‘void Function()‘.
出错的代码如下: 解决方案: 声明部分的写法改为: final void Function() onTap;
- vue3 router.push 传参路由跳转错误提示 Argument type {xxx} is not assignable to parameter type RouteLocationRaw
文章目录 问题描述 解决方法 问题描述 传参时,router.push中布尔值变量会给出一个错误提示 setup(){const router = useRouter();/** 查看已办任务的流程记 ...
- swagger Illegal DefaultValue null for parameter type integer
Swagger2异常:Illegal DefaultValue null for parameter type integer java 一.异常分析: Illegal DefaultValue nu ...
- 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, ...
- 解决 Illegal DefaultValue null for parameter type integer 异常
该异常是由 swagger 引起的 swagger 版本 1.9.2 解决原因:重新导入 swagger-annotations 和 swagger-models 版本 为 1.5.21 pom.xm ...
- Swagger2异常:Illegal DefaultValue null for parameter type integer java
Swagger2异常:Illegal DefaultValue null for parameter type integer java 参考文章: (1)Swagger2异常:Illegal Def ...
- 成功解决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 " ...
最新文章
- SAP MM里的ERS功能不适用于供应商寄售采购模式
- magento 让某个页面开启SSL访问
- 免费的SEO工具软件大全
- UVA 11557 - Code Theft (KMP + HASH)
- 大数据Hadoop2.x与Hadoop3.x相比较有哪些变化
- SSM后台框架下配合实现小程序图片上传至阿里云OOS
- 最长公共子序列php,动态规划(最长公共子序列LCS)
- C++基础——new与delete
- oracle数据文件5属于孤立,system数据文件问题库起不来,当家帮忙看看
- python 生意参谋_电商 Python 抓取 生意参谋-访客数据
- TikTok(国际版抖音)时间线
- 交换机基础知识 - 从零开始学习
- 微型机器学习,会是下一代AI革命吗?
- 创业公司 JPEGmini 可以将照片缩小5倍,但保证图片质量和分辨率
- CMD快捷指令之启动字符映射表
- airpods版本号_airpods蓝牙版本是多少,苹果AirPods正式版使用评测
- 夏普linux电视安装apk,夏普智能电视安装第三方应用看直播【最新教程】
- 电源设计1【测试方法、LDO】
- html英文期刊参考文献,论文参考文献英文格式
- 单片机:中断系统控制二极管的亮灭