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

只是学习扑动动画.使用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

相关文章

这篇文章主要讲解了“FlutterComponent动画的显和隐怎么实现...
这篇文章主要讲解了“flutter微信聊天输入框功能如何实现”,...
本篇内容介绍了“Flutter之Navigator的高级用法有哪些”的有...
这篇文章主要介绍“Flutter怎么使用Android原生播放器”,在...
Flutter开发的android端如何修改APP名称,logo,版本号,具体...
Flutter路由管理初识路由概念一.路由管理1.1.Route1.2.Mater...