我可以通过传递标志在我的手机上以发布模式运行应用程序--no-sound-null-safety --release,但既不能flutter build apk --enable-experiment=non-nullable
也flutter build apk --no-sound-null-safety
不能flutter build apk --enable-experiment=non-nullable --no-sound-null-safety
工作
我想在我的一些包含SvgPicture小部件的屏幕上进行小部件测试,但我不能这样做,因为它会引发异常。
重现错误的代码:
\nimport \'package:flutter/material.dart\';\nimport \'package:flutter_svg/svg.dart\';\nimport \'package:flutter_test/flutter_test.dart\';\n\n\nvoid main() {\n testWidgets(\n \'SvgPicture.asset passes\',\n (WidgetTester tester) async {\n await tester.pumpWidget(MaterialApp(\n home: Scaffold(\n body: SvgPicture.asset(\'icons/pencil.svg\'),\n ),\n ));\n await tester.pump();\n },\n );\n}\nRun Code Online (Sandbox Code Playgroud)\n执行结果:
\n\xe2\x95\x90\xe2\x95\x90\xe2\x95\xa1 EXCEPTION CAUGHT BY SVG \xe2\x95\x9e\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\nThe following assertion was thrown resolving a single-frame picture stream:\nUnable to load asset: icons/pencil.svg\n\nWhen the exception was thrown, this was the stack:\n#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:224:7)\n<asynchronous suspension>\n<asynchronous suspension>\n(elided one frame from package:stack_trace)\n...\n\nPicture provider: ExactAssetPicture(name: "icons/pencil.svg", bundle: null, colorFilter: null)\nPicture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#c2c00(), name: …Run Code Online (Sandbox Code Playgroud)