首页 > 解决方案 > Flutter:将空值传递给不可为空的参数值这将在启用运行时空安全时失败

问题描述

我正在使用 Flutter 开发 Web 应用程序。

我现在在我的应用程序上工作了几天,一切都很好,但是从今天早上开始,我在运行应用程序时总是收到这个警告:

"A null value was passed into a non-nullable parameter value
This will become a failure when runtime null safety is enabled."

在我更改代码中的 RANDOM 内容之前,不会发生任何错误,这并不重要。然后出现此错误:

Error: Invalid argument(s): Extension already registered: ext.flutter.disassemble
at Object.throw_ [as throw] (http://localhost:51499/dart_sdk.js:4461:11)
at Object.registerExtension$ [as registerExtension] (http://localhost:51499/dart_sdk.js:48563:17)
at Object.webOnlyInitializeEngine (http://localhost:51499/dart_sdk.js:163999:15)
at _initializePlatform (http://localhost:51499/dart_sdk.js:134269:15)
at _initializePlatform.next (<anonymous>)
at runBody (http://localhost:51499/dart_sdk.js:36923:34)
at Object._async [as async] (http://localhost:51499/dart_sdk.js:36951:7)
at Object._initializePlatform (http://localhost:51499/dart_sdk.js:134265:18)
at Object.webOnlyInitializePlatform (http://localhost:51499/dart_sdk.js:134257:35)
at main$ (http://localhost:51499/web_entrypoint.dart.lib.js:16:16)
at main$.next (<anonymous>)
at runBody (http://localhost:51499/dart_sdk.js:36923:34)
at Object._async [as async] (http://localhost:51499/dart_sdk.js:36951:7)
at Object.main$ [as main] (http://localhost:51499/web_entrypoint.dart.lib.js:14:18)
at RequireRestarter__reload_closure.call$0 (http://localhost:51499/dwds/src/injected/client.js:22818:15)
at Object.Primitives_applyFunction (http://localhost:51499/dwds/src/injected/client.js:860:30)
at Object.Function_apply (http://localhost:51499/dwds/src/injected/client.js:5012:16)
at _callDartFunctionFast (http://localhost:51499/dwds/src/injected/client.js:7001:16)
at http://localhost:51499/dwds/src/injected/client.js:6992:18
at <anonymous>:1:8
at Object.runMain (http://localhost:51499/dwds/src/injected/client.js:8343:15)
at http://localhost:51499/dwds/src/injected/client.js:22335:19
at _wrapJsFunctionForAsync_closure.$protected (http://localhost:51499/dwds/src/injected/client.js:3636:15)
at _wrapJsFunctionForAsync_closure.call$2 (http://localhost:51499/dwds/src/injected/client.js:10848:12)
at Object._asyncStartSync (http://localhost:51499/dwds/src/injected/client.js:3600:20)
at main__closure1.$call$body$main__closure (http://localhost:51499/dwds/src/injected/client.js:22347:16)
at main__closure1.call$1 (http://localhost:51499/dwds/src/injected/client.js:22279:19)
at StaticClosure._rootRunUnary [as call$2$5] (http://localhost:51499/dwds/src/injected/client.js:3958:16)
at _CustomZone.runUnary$2$2 (http://localhost:51499/dwds/src/injected/client.js:12164:39)
at _CustomZone.runUnaryGuarded$1$2 (http://localhost:51499/dwds/src/injected/client.js:12092:14)
at _ControllerSubscription._sendData$1 (http://localhost:51499/dwds/src/injected/client.js:11642:19)
at _DelayedData.perform$1 (http://localhost:51499/dwds/src/injected/client.js:11796:59)
at _PendingEvents_schedule_closure.call$0 (http://localhost:51499/dwds/src/injected/client.js:11845:14)
at Object._microtaskLoop (http://localhost:51499/dwds/src/injected/client.js:3801:21)
at StaticClosure._startMicrotaskLoop (http://localhost:51499/dwds/src/injected/client.js:3807:11)
at _AsyncRun__initializeScheduleImmediate_internalCallback.call$1 (http://localhost:51499/dwds/src/injected/client.js:10720:9)
at invokeClosure (http://localhost:51499/dwds/src/injected/client.js:1172:26)
at MutationObserver.<anonymous> (http://localhost:51499/dwds/src/injected/client.js:1191:18)

已经运行了颤振医生和颤振分析-没有什么特别的。

任何想法为什么会发生这种情况?其他人之前遇到过这个错误吗?

(哦,当我将颤振升级到 1.19 时它开始发生,所以我想它与此有关)

谢谢 :)

标签: flutterflutter-web

解决方案


你是对的。此问题发生在最新版本上。

在尝试进一步调查时,现在我打开了问题 56844


推荐阅读