DART CONST构造函数 - 可能默认吗?
如果我们从绒毛上收到警告来使用它,为什么不能推断const呢? 为什么,如果可能的话,所有类构造函数默认不是const? 这将使我们的代码更加干净。
Why can't const be inferred, if we get warnings from Lint to use it?
Why, if possible, all classes constructors aren't by default const?
This would let our code much more clean.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用const的要点不是协助编译器进行优化,而是保护自己免受错误,这意味着它可以防止您无意中修改您没想到会被修改的东西。
通常,当您没有太多变量时,它可以更轻松地编程A。
无需记住应该修改哪一个,哪个应该不应该进行。
The main point of using const is not to assist the compiler in optimizations but to protect yourself from mistakes which means it prevents you from inadvertently modifying something you didn't expect to be modified.
Generally it makes it easier to program a when there is too many variables you dont.
No need to memorize which one should be modified and which one shouldn't.