我想解决Flutter App中构建失败的问题

问题描述

在构建诸如Flutter_form_builder,Flutter_chips_input之类的第3方软件包时,services软件包也会出错,这会导致构建失败,我认为这是软件包版本崩溃的问题....但是,我可以不能解决这个问题...

我该如何解决

下面是错误代码

谢谢。

错误代码

../Flutter/.pub-cache/hosted/pub.dartlang.org/Flutter_form_builder-3.7.2/lib/src/fields/form_builder_range_slider.dart:21:9: Error: Type 'RangeSemanticFormatterCallback' not found.
  final RangeSemanticFormatterCallback semanticFormatterCallback;
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../Flutter/.pub-cache/hosted/pub.dartlang.org/Flutter_chips_input-1.6.1/lib/src/chips_input.dart:62:7: Error: The non-abstract class 'ChipsInputState' is missing implementations for these members:
 - TextInputClient.currentAutofillScope
 - TextInputClient.currentTextEditingValue
 - TextInputClient.performPrivateCommand
 - TextInputClient.showAutocorrectionPromptRect
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 ChipsInputState<T> extends State<ChipsInput<T>>
      ^^^^^^^^^^^^^^^
../Flutter/packages/Flutter/lib/src/services/text_input.dart:805:22: Context: 'TextInputClient.currentAutofillScope' is defined here.
  AutofillScope? get currentAutofillScope;
                     ^^^^^^^^^^^^^^^^^^^^
../Flutter/packages/Flutter/lib/src/services/text_input.dart:793:25: Context: 'TextInputClient.currentTextEditingValue' is defined here.
  TextEditingValue? get currentTextEditingValue;
                        ^^^^^^^^^^^^^^^^^^^^^^^
../Flutter/packages/Flutter/lib/src/services/text_input.dart:814:8: Context: 'TextInputClient.performPrivateCommand' is defined here.
  void performPrivateCommand(String action,Map<String,dynamic> data);
       ^^^^^^^^^^^^^^^^^^^^^
../Flutter/packages/Flutter/lib/src/services/text_input.dart:823:8: Context: 'TextInputClient.showAutocorrectionPromptRect' is defined here.
  void showAutocorrectionPromptRect(int start,int end);
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../Flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:273:8: Error: The method 'FlushbarRoute.install' has more required arguments than those of overridden method 'OverlayRoute.install'.
  void install(OverlayEntry insertionPoint) {
       ^
../Flutter/packages/Flutter/lib/src/widgets/routes.dart:46:8: Context: This is the overridden method ('install').
  void install() {
       ^
../Flutter/.pub-cache/hosted/pub.dartlang.org/Flutter_form_builder-3.7.2/lib/src/fields/form_builder_range_slider.dart:21:9: Error: 'RangeSemanticFormatterCallback' isn't a type.
  final RangeSemanticFormatterCallback semanticFormatterCallback;
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
../Flutter/.pub-cache/hosted/pub.dartlang.org/flushbar-1.9.1/lib/flushbar_route.dart:281:18: Error: Too many positional arguments: 0 allowed,but 1 found.
Try removing the extra positional arguments.
    super.install(insertionPoint);
                 ^


FAILURE: Build Failed with an exception.

* Where:
Script '/Users/gabriel/Git/Flutter/packages/Flutter_tools/gradle/Flutter.gradle' line: 900

* What went wrong:
Execution Failed for task ':app:compileFlutterBuildDebug'.
> Process 'command '/Users/gabriel/Git/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 32s

##############解决方案事物###############

这种情况是由于选择了错误的软件包版本引起的。 因此,我尝试更改“ Flutter_form_builder”的版本! 我解决了这个问题!

解决方法

删除std::vector,删除pubspec.lock,然后运行

podfile.lock

,

这是由于flutter_form_builder与您的flutter版本不兼容。根据flutter_form_builder的github页上的建议,您需要根据您的flutter版本选择插件。

在github页面上:

对于Flutter 1.17.x,请使用版本3.12.x

对于Flutter 1.20.x,请使用版本3.13.x

对于Flutter 1.22.X,请使用版本3.14.x

您必须在pubspec.yaml中输入正确的版本号