Flutter编译错误:必须返回非空值,因为返回类型“String”不允许为空 - displayString

atr*_*eon 4 dart flutter

我的测试无法在我的 Flutter 项目引用的仅 Dart 项目中编译和运行。我收到以下错误消息

\n
Failed to precompile test:test:\n../../../../../../../../../.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.\n  String get displayString {\n
Run Code Online (Sandbox Code Playgroud)\n

有什么想法吗?

\n
Flutter 2.2.1 (current stable channel)\nTools \xe2\x80\xa2 Dart 2.13.1\n
Run Code Online (Sandbox Code Playgroud)\n

(我也在 Flutter 的 github 中提出了这个问题)\n https://github.com/flutter/flutter/issues/83683

\n

atr*_*eon 5

有一个组件使用分析器版本 1.0.0

升级此组件以使用分析器版本 1.7 或更高版本似乎解决了我的问题。