flutter - 我想解决 Flutter App 构建失败的问题
问题描述
在构建一些 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”的版本!我解决了这个问题!
解决方案
这是由于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 中输入正确的版本号
推荐阅读
- jquery - 使用 JQuery 未打开 Bootstrap 模式窗口
- java - 为什么输出总是收敛到 0.5?
- python - 我可以使用 pandas 替换函数将多列中的不同值替换为唯一值吗?
- reporting-services - 需要帮助将 excel 公式“翻译”为 SSRS 表达式
- php - 最大值必须在数组中
- powershell - 如何将多个文件通过管道传输到 Copy-Item 并保持目录结构?
- python - ValueError:检查时出错:预期dense_1_input有2维,但得到了形状为(1、16、16、512)的数组
- asp.net - Bootstrap 4.2.1:子文件夹页面崩溃导航栏
- python-3.x - ModuleNotFoundError:没有名为“gather_keys_oauth2”的模块
- python - python 的批处理文件语法(*.* 或 *.csv)的等价物是什么?