dart - 有没有 *?飞镖中的操作员?
问题描述
*?
飞镖中有操作员吗?
我正在使用copy_with_extension
生成代码,目前我有类似的错误
[SEVERE] copy_with_extension_gen:copy_with_extension_gen on lib/models/my_model.dart:
An error `FormatterException` occurred while formatting the generated source for
`package:app/models/my_model.dart`
which was output to
`lib/models/my_model.copyWith.g.part`.
This may indicate an issue in the generator, the input source code, or in the
source formatter.
Could not format because the source could not be parsed:
line 8, column 51 of .: Expected to find '}'.
╷
8 │ MyModel copyWith({ String*? myField})
{
│ ^
╵
*?
很奇怪,?
是可以为空的,是什么*
?
由于我正在使用sdk: ">=2.7.0 <3.0.0"
并且忙于迁移空安全性,我想分叉并更改为不健全的空安全性
解决方案
Dart中没有*?
运算符。您的代码生成器正在生成无效代码,*
它不会发生在它发生的地方。
这很可能是代码生成器被分析器的更改绊倒了。该类型String*
可以是不健全的可空类型的内部表示String
( pre-nullsafetyp 代码中的经典类型可以是null
,而不是空安全String
的不能)。代码生成器应该发出正确的源名称,而不是内部表示。我会向该代码生成器提出问题。
推荐阅读
- java - 将 Java 类包装到 Python 中的最佳方法
- visual-studio - 使用 Visual Studio 2017 在 Windows 7 上安装 Gazebo 8
- r - 在 R 中读取凌乱的 json
- hyperledger-composer - 企业级超级账本作曲家
- javascript - 如何让两个输入框同时输入按键?
- timer - 如何从最后一个单元格滚动回滚动视图的第一个单元格以及如何在 swift 4 中为每个单元格添加一个按钮?
- android - 通过 LAN 模拟器
- python - 将变量推送到模板的最佳实践是什么?
- c# - 如何让对象标签有它的位置?
- html - 将数组值更改上的数组复制到另一个组件并更改组件视图