未来的类型是什么。

发布于 2025-02-13 21:33:36 字数 185 浏览 0 评论 0原文

我在我的棉布检查中添加了一个“ ewndery_specify_type”,它要求我输入以下类型:

等待Future< ???> .delayed(consturation(contration duration(seconds:1));> 这种类型应该是什么,为什么?它应该是无效的还是空的?

I added an "always_specify_type" to my lint check, it is asking me to enter the type for:

await Future<???>.delayed(const Duration(seconds: 1));
What should this type be and why? Should it be Void or Null or something else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

为人所爱 2025-02-20 21:33:36

您应该使用void,因为您无意实际使用从future中返回的值。通过这样做,如果您最终试图偶然使用返回的值,您将获得编译错误。

You should use void since you have no intention of actually using the value returned from the Future. By doing so, you will get a compile error if you are ending up trying to use the returned value by accident.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文