I'm trying to require (or at least warn in the linter) that when I create an object I also define when it should be disposed, if necessary. An example of this is the warning for Sink: Close instances of dart.core.Sink, which appears in VS Code if you create a Sink without ever calling .close(). The issue is that I have classes that define multiple Sink objects, so I close all of them in a dispose method for the class, which solves the dart.core.Sink warning but doesn't solve the underlying issue, because this method might never be called.
Is there any way to create a similar error/warning for my own classes? I've looked at adding new rules to the linter, but this seems like a lot of work, and before I go that far, I was wondering if there's any mixin or similar that would give me this functionality.