简体   繁体   English

将课程标记为需要在Dart中处置

[英]Mark a class as needing for disposal in Dart

I was wondering if there's a way to mark a class as "needing disposal" in Dart. 我想知道是否有办法在Dart中将某个班级标记为“需要处置”。

What I mean to do is replicate the linter warning that gets shown, for example, when I create a StreamController and not dispose it somewhere in my code, the close_sinks warning is shown. 我的意思是复制显示的linter警告,例如,当我创建StreamController而不将其放置在代码中的某个位置时,将显示close_sinks警告。

This does not happen for other classes like AnimationController or ValueNotifier . 对于其他类,例如AnimationControllerValueNotifier ,不会发生这种情况。

What does make a class raise this kind of warning? 是什么使班级提出这种警告? How can I replicate that for my own needs? 我该如何复制自己的需求? Can I at all? 我可以吗?

Thanks in advance! 提前致谢!

目前没有办法,但是您可以在此处关注问题的进展: https : //github.com/dart-lang/linter/issues/697

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM