如何解决 Flutter 中的“FwfhTextStyle”错误?

Vin*_*tar 20 gradle dart android-studio mobile-development flutter

由于此错误,我的应用程序未构建,并且我无法理解该错误。我尝试了“颤振升级”和“颤振获取”,但没有任何帮助。

Launching lib/main.dart on SM A127F in debug mode...
Running Gradle task 'assembleDebug'...
../../flutter/.pub-cache/hosted/pub.dartlang.org/fwfh_text_style-2.7.3+2/lib/fwfh_text_style.dart:11:7: Error: The non-abstract class 'FwfhTextStyle' is missing implementations for these members:
 - TextStyle.fontVariations
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class FwfhTextStyle extends _TextStyleProxy {
      ^^^^^^^^^^^^^
../../flutter/packages/flutter/lib/src/painting/text_style.dart:789:33: Context: 'TextStyle.fontVariations' is defined here.
  final List<ui.FontVariation>? fontVariations;
                                ^^^^^^^^^^^^^^ 


FAILURE: Build failed with an exception.

* Where:
Script '/home/vrs/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/home/vrs/flutter/bin/flutter'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 16s
Exception: Gradle task assembleDebug failed with exit code 1

Run Code Online (Sandbox Code Playgroud)

Ahm*_*esh 14

当我升级到 Flutter 后,3.3.0我出现了这个错误

经过一番搜索后,我通过在项目中运行软件包升级来解决它

flutter pub upgrade 
Run Code Online (Sandbox Code Playgroud)

然后

flutter clean 

flutter pub get
Run Code Online (Sandbox Code Playgroud)


小智 14

请升级依赖来尝试一下flutter pub upgrade fwfh_text_style


小智 1

我认为这是关于final List<ui.FontVariation>? fontVariations;

无论它是在最后一个索引处定义的还是根本没有定义。

我会做类似的事情来防止错误。List<ui.FontVariation> fontVariations = [];