android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类

android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类,第1张

概述只是学习扑动动画.使用SingleTickerProviderStateMixin IDE给我这个错误: The class ‘SingleTickerProviderStateMixin’ can’t be used as a mixin because it extends a class other than Object 我的代码: import 'package:flutter/mate 只是学习扑动动画.使用SingleTickerProvIDerStateMixin IDE给我这个错误:

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.yaml

analyzer:  language:    enableSuperMixins: true

另见https://github.com/flutter/flutter/blob/master/analysis_options.yaml#L24

总结

以上是内存溢出为你收集整理的android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类全部内容,希望文章能够帮你解决android – 错误:类’SingleTickerProviderStateMixin’不能用作mixin,因为它扩展了Object以外的类所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1000607.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-21
下一篇 2022-05-21

发表评论

登录后才能评论

评论列表(0条)

保存