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

uxh89sit  于 2022-11-14  发布在  Flutter
关注(0)|答案(5)|浏览(389)

我的应用程序没有建立,因为这个错误,我不能理解的错误。我尝试了“flutter升级”和“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
wnvonmuf

wnvonmuf1#

在我升级到Flutter 3.3.0后,这个错误出现在我面前
经过一些搜索,我解决了它运行升级包在我的项目

flutter pub upgrade

然后

flutter clean 

flutter pub get
ghg1uchk

ghg1uchk2#

请通过升级依赖项flutter pub upgrade fwfh_text_style进行尝试

ctehm74n

ctehm74n3#

我想这是关于final List<ui.FontVariation>? fontVariations;的定义
无论是在最后一个索引中定义还是根本没有定义。
我会做类似的事情来防止错误。List<ui.FontVariation> fontVariations = [];

kx5bkwkv

kx5bkwkv4#

我尝试了flutter upgrade,然后flutter clean,但它对我不起作用。
然后我运行这个命令flutter pub outdated,它运行得很好。

pb3s4cty

pb3s4cty5#

尝试添加fwfh_text_style这个插件在您的项目中,如果没有添加。它为我工作。

相关问题