Ability to deprecate an export
#48376
Labels
closed-duplicate
Closed in favor of an existing report
devexp-warning
Issues with the analyzer's Warning codes
legacy-area-analyzer
Use area-devexp instead.
type-enhancement
A request for a change that isn't a bug
We can currently
@Deprecate(...)
a declaration, which should warn for any code that would change behavior if that declaration was removed.I would like to be able to deprecate exports, so that code would get warned if they rely on that export for access to a declaration (they'd break if the export was removed, just as for declarations).
My use-case is that I want to move a declaration to another library. To do that, I want the same declaration to be temporarily available from both libraries, one deprecated and the other not.
Since it must be the same declaration (otherwise, their names would clash), I can't annotate the declaration itself without deprecating both sources.
So, instead I'd put the declaration into either one of the two libraries, or a shared third library, and export it deprecated from one library and not from the other.
Any user who imports both should get no warning (they have a non-deprecated path to the declaration).
Any user who imports only through the deprecated export will get a warning.
Eventually, the deprecated export goes away, and all is well.
(This has happened already with
BytesBuilder
moving fromdart:io
todart:typed_data
. There is a non-functional deprecation on the export indart:io
. It's happening again to me with another feature, hence this request.)The text was updated successfully, but these errors were encountered: