今天在更新了AndroidStudio后出现了异常,全部的Mixin都被分析器指出了错误。报错信息以下:git
The class 'SingleTickerProviderStateMixin' can't be used as a mixin because it extends a class other than Object.github
最终发现是分析器出了问题,在Dart1中要使用Mixin须要强制继承至Object,然后来放宽了这一限制。参考这里,但默认状况下没有开启放宽。ide
在项目根目录下建立 analysis_options.yaml
文件(和pubspec.yaml
平级),并添加如下代码,开启SuperMixincode
analyzer: language: enableSuperMixins: true
更多请参考这里继承