Flutter:将null值传递到不可为null的参数值中当启用运行时null安全性时,此操作将失败 [英] Flutter: A null value was passed into a non-nullable parameter value This will become a failure when runtime null safety is enabled

查看:937
本文介绍了Flutter:将null值传递到不可为null的参数值中当启用运行时null安全性时,此操作将失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm using Flutter to develop a Web App.

我正在使用我的应用程序几天,一切正常,但是从今天早上开始,我总是在运行该应用程序时收到此警告:

I'm working on my app for few days now, and everything was OK, but since this morning I always get this warning at the moment I run the app:

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

在我更改代码中的RANDOM内容之前,没有任何真正的错误,这实际上无关紧要. 然后出现此错误:

Nothing wrong really happens until I change RANDOM stuff in my code, doesn't really matter what it is. Then this error shows up:

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)

已经跑了扑扑医生 和颤动分析-没什么特别的.

Already ran flutter doctor and flutter analyze - showed nothing special.

为什么会发生这种情况?其他任何人以前都收到过此错误吗?

Any ideas why this can happen? Anyone else got this error before?

(哦,当我将flutter升级到1.19时就开始发生了,所以我想这与此有关)

(Oh, and it started happening when I've upgraded flutter to 1.19, so I guess it relates to that)

谢谢:)

推荐答案

您是对的.此问题发生在最新版本上.

You're right. This issue happens on latest version.

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

While trying to investigate further, for now I opened the issue 56844.

这篇关于Flutter:将null值传递到不可为null的参数值中当启用运行时null安全性时,此操作将失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆