【发布时间】:2021-06-07 09:37:28
【问题描述】:
我的测试无法在我的 Flutter 项目引用的仅 Dart 项目中编译和运行。我收到以下错误消息
Failed to precompile test:test:
../../../../../../../../../.pub-cache/hosted/pub.dartlang.org/analyzer-1.0.0/lib/src/error/best_practices_verifier.dart:1952:14: Error: A non-null value must be returned since the return type 'String' doesn't allow null.
String get displayString {
有什么想法吗?
Flutter 2.2.1 (current stable channel)
Tools • Dart 2.13.1
(我也在 Flutter 的 github 上问过这个问题) https://github.com/flutter/flutter/issues/83683
【问题讨论】:
-
2.13.1(颤振稳定)。我认为 Dart 在编译时使用的 displayString 函数(不是我写的函数)
-
只是为了确认有问题的函数在下面的文件
pub.dartlang.org/analyzer-1.0.0/lib/src/error/best_practices_verifier.dart的分析器包中