The class ‘SingleTickerProvIDerStateMixin’ can’t be used as a mixin because
it extends a class other than Object
我的代码:
import 'package:Flutter/material.dart'; class AnimationControllerOutputbody extends StatefulWidget with { @overrIDe _AnimationControllerOutputbodyState createState() => new _AnimationControllerOutputbodyState(); } class _AnimationControllerOutputbodyState extends State<AnimationControllerOutputbody> with SingleTickerProvIDerStateMixin { AnimationController animation; @overrIDe voID initState() { super.initState(); animation = new AnimationController( vsync: this,duration: new Duration(seconds: 3),); animation.addListener(() { this.setState(() {}); }); } @overrIDe Widget build(BuildContext context) { return new GestureDetector( child: new Center( child: new Text( animation.isAnimating ? animation.value.toStringAsFixed(3) : "Tap me!",style: new TextStyle( FontSize: 50.0,),onTap: () { animation.forward(from: 0.0); },); } @overrIDe voID dispose() { animation.dispose(); super.dispose(); } }
我的代码有什么问题?
解决方法 添加到analysis_options.yamlanalyzer: language: enableSuperMixins: true
另见https://github.com/flutter/flutter/blob/master/analysis_options.yaml#L24
总结以上是内存溢出为你收集整理的android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类全部内容,希望文章能够帮你解决android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)