1

在构建一些 3rd 方包时,比如flutter_form_builder,flutter_chips_input颤振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”的版本!我解决了这个问题!

4

2 回答 2

3

这是由于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 中输入正确的版本号

于 2020-11-13T04:03:38.960 回答
2

删除pubspec.lock、删除podfile.lock和运行

cd ios && pod repo update && cd .. && flutter clean && flutter pub get

于 2020-10-19T09:28:32.160 回答