Closed lrhn closed 6 years ago
This will need a full analysis server refactoring to support. This tool can't do that as it; we use the analysis server to locate deprecated references, but then use simple heuristics to modify the source code. In order to do a better job here, we'll need additional metadata on deprecated annotations (https://github.com/dart-lang/sdk/issues/32726), and then we can create real analysis server refactorings.
Or a small RegExp based script.
If you ever insert jsonEncode
, jsonDecode
or json
, remember that. Then if there is a show json
in the import for dart:convert
(or any import, let's not be stingy, it might be reexported), then replace that by the necessary ones.
Ditto for base64.
Otherwise you can get "jsonEncode not declared" errors and/or unused import warnings.
You'd end up chasing a long tail of smaller issues. The analysis server has a semantic understanding of the code, and can do a much better job here in terms of leaving behind correct code.
I'd like to close this in favor of dart-lang/sdk#32726.
If a file contains an import of
dart:convert
with a show clause, please convert all the matching imported names as well. Include the encode/decode functions.That is:
should be come
(or as many of the first three as are actually used, it might just be one of them).