我从一个朋友那里下载了一个flutter项目,结果出现了这个错误



strong文本

错误:无法使用健全的null安全性运行,因为以下依赖项不支持零安全:

  • 软件包:google_fonts
  • 包:http
  • 程序包:http_parser

有关解决方案,请参阅https://dart.dev/go/unsound-null-safety/C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:108:9:错误:找不到类型"ImageProvider"。最终ImageProvider?背景图像;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:113:9:错误:找不到类型"ImageProvider"。最终ImageProvider?前景图像;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:185:14:错误:找不到类型"ImageProvider"。所需的ImageProvider图像,^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:336:14:错误:找不到类型"ImageConfiguration"。所需的ImageConfiguration配置,^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:369:3:错误:找不到类型"ImageConfiguration"。ImageConfiguration获取配置=&gt_配置^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:370:3:错误:找不到类型"ImageConfiguration"。图像配置(_configuration);^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:371:21:错误:找不到类型"ImageConfiguration"。设置配置(ImageConfiguration值){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:210:9:错误:找不到类型"ImageProvider"。最终ImageProvider?activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:219:9:错误:找不到类型"ImageProvider"。最终ImageProvider?inactiveThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:530:9:错误:找不到类型"ImageProvider"。最终ImageProvider?activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:532:9:错误:找不到类型"ImageProvider"。最终ImageProvider?inactiveThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:795:3:错误:找不到类型"ImageProvider"。ImageProvider?get-activeThumbImage=&gt_activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:796:3:错误:找不到类型"ImageProvider"。ImageProvider_activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:797:24:错误:找不到类型"ImageProvider"。设置activeThumbImage(ImageProvider?值){^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:814:3:错误:找不到类型"ImageProvider"。ImageProvider?get-inactiveThumbImage=&gt_inactiveThumbImage;

^^^^^^^^^^^^^^^^^^

/C:/src/flutter/packages/flutter/lib/src/widgets/scroll_aware_image_provider。dart:110:36:错误:找不到类型"解码器回调"。ImageStreamCompleter加载(T密钥,解码器回调解码)=>imageProvider.load(密钥,解码);^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/widgets/scroll_aware_image_provider。dart:113:23:错误:找不到类型"ImageConfiguration"。未来获取密钥(ImageConfiguration配置)=>imageProvider.gapturenKey(配置);^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/cupertino/route.dart:915:44:错误:找不到类型"ImageConfiguration"。void paint(画布画布、偏移偏移、ImageConfiguration配置){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2088:5:错误:找不到类型"ImageConfiguration"。ImageConfiguration configuration=ImageConfiguration.empty,^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2132:3:错误:找不到类型"ImageConfiguration"。ImageConfiguration获取配置=&gt_配置^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2133:3:错误:找不到类型"ImageConfiguration"。图像配置(_configuration);^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/proxy_box.dart:2134:21:错误:找不到类型"ImageConfiguration"。设置配置(ImageConfiguration值){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/table.dart:376:5:错误:找不到类型"ImageConfiguration"。ImageConfiguration configuration=ImageConfiguration.empty,^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/rendering/table.dart:552:3:错误:找不到类型"ImageConfiguration"。ImageConfiguration获取配置=&gt_配置

^^^^^^^^^^^^^

/C:/src/flutter/packages/flutter/lib/src/material/circle_avatar.dart:113:9:错误:"ImageProvider"不是类型。最终ImageProvider?前景图像;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/download.dart:81:42:错误:没有为类"_DropdownMenuPainter"定义方法"ImageConfiguration"。

  • '_DropdownMenuPainter'来自'package:flutter/src/material/dropload.dart'('/C:/src/flutter/packages/flutter/lib/src/material/download.dart.dart')。请尝试将名称更正为现有方法的名称,或定义名为"ImageConfiguration"的方法。_painter.paint(canvas,rect.topLeft,ImageConfiguration(size:rect.size));^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:185:14:错误:"ImageProvider"不是类型。所需的ImageProvider图像,^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:336:14:错误:"ImageConfiguration"不是类型。所需的ImageConfiguration配置,^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:370:3:错误:"ImageConfiguration"不是类型。图像配置(_configuration);^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:371:21:错误:"ImageConfiguration"不是类型。设置配置(ImageConfiguration值){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/ink_decoration.dart:394:11:错误:"ImageConfiguration"不是类型。final ImageConfiguration sizedConfiguration=configuration.copyWith(^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:210:9:错误:"ImageProvider"不是类型。最终ImageProvider?activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:219:9:错误:"ImageProvider"不是类型。最终ImageProvider?inactiveThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:530:9:错误:"ImageProvider"不是类型。最终ImageProvider?activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:532:9:错误:"ImageProvider"不是类型。最终ImageProvider?inactiveThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:796:3:错误:"ImageProvider"不是类型。ImageProvider_activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:797:24:错误:"ImageProvider"不是类型。设置activeThumbImage(ImageProvider?值){^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:815:3:错误:"ImageProvider"不是类型。ImageProvider_inactiveThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:816:26:错误:"ImageProvider"不是类型。设置inactiveThumbImage(ImageProvider?值){^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:854:3:错误:"ImageConfiguration"不是类型。图像配置_配置^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:855:21:错误:"ImageConfiguration"不是类型。设置配置(ImageConfiguration值){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:904:3:错误:"ImageProvider"不是类型。ImageProvider_cachedThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:908:60:错误:"ImageProvider"不是类型。BoxDecoration _createDefaultThumbDecoration(颜色、ImageProvider?图像、ImageErrorListener?errorListener){^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:950:11:错误:"ImageProvider"不是类型。最终ImageProvider?thumbImage=已启用^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch.dart:1018:5:错误:"ImageProvider"不是类型。ImageProvider?thumbImage,^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch_list_tile.dart:265:9:错误:"ImageProvider"不是类型。最终ImageProvider?activeThumbImage;^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/material/switch_list_tile.dart:270:9:错误:"ImageProvider"不是类型。最终ImageProvider?inactiveThumbImage

/C:/src/flutter/packages/fluttstrongtexter/lib/src/painting/image_resolution.dart:283:41:错误:"ImageConfiguration"不是类型。未来获取密钥(ImageConfiguration配置){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:291:15:错误:"AssetBundleImageKey"不是类型。完成者?完井工;^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:292:12:错误:"AssetBundleImageKey"不是类型。将来后果^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:302:15:错误:"AssetBundleImageKey"不是类型。final AssetBundleImageKey=AssetBundleImage key(^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:317:38:错误:"AssetBundleImageKey"不是类型。result=SynchronousFuture(键);^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:334:27:错误:"AssetBundleImageKey"不是类型。completer=completer();^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:302:41:错误:没有为类"AssetImage"定义方法"AssetBundleImageKey"。

  • "AssetImage"来自"package:flutter/src/ppainting/image_resolution.dart"("/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart")。请尝试将名称更正为现有方法的名称,或定义名为"AssetBundleImageKey"的方法。final AssetBundleImageKey=AssetBundleImage key(^^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/image_resolution.dart:351:39:错误:"ImageConfiguration"不是类型。字符串_chooseVariant(String main、ImageConfiguration config、List?candidate){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/shape_decoration.dart:365:35:错误:"ImageConfiguration"不是类型。void _paintImage(画布画布,ImageConfiguration配置){^^^^^^^^^^^^^^^^^^/C:/src/flutter/packages/flutter/lib/src/painting/shape_decoration.dart:379:44:错误:"ImageConfiguration"不是类型。void paint(画布画布、偏移偏移、ImageConfiguration配置){^^^^^^^^^^^^^^^^^^

失败:生成失败,出现异常。

  • 其中:脚本"C:\src\flatter\packages\flutter_tools\gradle\flatter.gradle"行:1156

  • 哪里出了问题:任务":app:compileFlutterBuildDebug"的执行失败。

进程"命令"C:\src\flatter\bin\flatter.bat"以非零退出值1 完成

  • 尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获得更多日志输出。使用--scan运行以获得完整的见解。

  • 获取更多帮助,请访问https://help.gradle.org

构建在19秒内失败异常:Gradle任务assemblyDebug失败,退出代码为1

您应该安装与朋友使用的相同的flutter版本。我认为你的版本更大。请您的朋友向您发送flutter doctor输出,并使您的颤振版本相同。

FVM可能是一个合适的工具(在不删除自己的版本的情况下安装所需的版本):https://fvm.app/docs/getting_started/installation

然后简单地运行:

fvm install [version of your friend]
fvm use [version]

您可以禁用空安全并使用以下命令运行项目:

flutter run --no-sound-null-safety

相关内容

  • 没有找到相关文章

最新更新