Dart错误:NoSuchMethodError:'<意外的Null值>'

时间:2019-11-25 17:47:30

标签: dart angular-dart

我遇到很多“ NoSuchMethodError:”“ 错误。

我有一个带有角度的大型Web应用程序。现在我正在使用dart 2.6.1。 首先,我有一个案例,其中定义了一个static const变量(例如static Duration period = Duration(seconds: 30);)。

使用此变量导致该错误。删除const关键字,一切似乎都可以正常工作。 但是后来我从一个角度组件中得到了同样的错误。

我有很多依赖关系,恐怕这会给编译器造成一些奇怪的问题。

有任何提示吗?

我不知道const变量是否有内存限制,在这种情况下,如何检查该限制(或增加该限制)? 我可以做些什么来验证问题所在? 以下是堆栈跟踪的一部分:

Error_handler: reason NoSuchMethodError: '<Unexpected Null Value>'
method not found
Receiver: null
Arguments: [], exception, NoSuchMethodError: '<Unexpected Null Value>'
method not found
Receiver: null
Arguments: [], stack dart:sdk_internal                                                          createTimer
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 210:25  [_createTimer]
dart:sdk_internal                                                          new
package:angular_components/material_popup/material_popup.dart 510:25       [_onPopupOpened]
package:angular_components/material_popup/material_popup.dart 472:11       <fn>
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18  <fn>
dart:sdk_internal                                                          runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18  [_runUnary]
dart:sdk_internal                                                          add
package:angular_components/material_popup/material_popup.dart 862:29       <fn>
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18  <fn>
dart:sdk_internal                                                          runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18  [_runUnary]
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 144:18  <fn>
dart:sdk_internal                                                          runUnary
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 141:18  [_runUnary]
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18  <fn>
dart:sdk_internal                                                          run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18  [_run]
dart:sdk_internal                                                          <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 117:11  <fn>
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18  <fn>
dart:sdk_internal                                                          run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18  [_run]

dart:sdk_internal                                                          listen
package:angular_components/material_popup/material_popup.dart 468:50       [_open]
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18  <fn>
dart:sdk_internal                                                          run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18  [_run]
dart:sdk_internal                                                          <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 117:11  <fn>
package:stack_trace                                                        <fn>
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 132:18  <fn>
dart:sdk_internal                                                          run
package:angular/src/core/change_detection/..%5Czone%5Cng_zone.dart 129:18  [_run]

dart:sdk_internal                                                                                                     scheduleMicrotask
package:angular_components/material_popup/material_popup.dart 338:9                                                   set visible

编辑1:

我移回2.5.2,一切工作正常。 然后我安装了2.6.1,问题再次出现。 所以,我认为这与2.6.1有关

0 个答案:

没有答案