小编Jef*_*ley的帖子

具有零安全性的 Dart / Flutter 测试设置

更新:这是一个文档错误,已修复:https : //github.com/dart-lang/test/pull/1471

根据测试包(https://pub.dev/packages/test)的文档/示例,此测试用例应该可以工作并且不会触发警告。但是它确实:

The non-nullable local variable 'b' must be assigned before it can be used.
Try giving it an initializer expression, or ensure that it's assigned on every execution path.dart(not_assigned_potentially_non_nullable_local_variable)
Run Code Online (Sandbox Code Playgroud)

将变量标记为后期作品,但我想在我提交一个错误说文档错误之前检查我没有遗漏任何东西。=)

The non-nullable local variable 'b' must be assigned before it can be used.
Try giving it an initializer expression, or ensure that it's assigned on every execution path.dart(not_assigned_potentially_non_nullable_local_variable)
Run Code Online (Sandbox Code Playgroud)

null unit-testing dart flutter

4
推荐指数
2
解决办法
1699
查看次数

标签 统计

dart ×1

flutter ×1

null ×1

unit-testing ×1