visitImportDirective method
ImportDirective?
visitImportDirective(
- ImportDirective node
)
override
Implementation
@override
ImportDirective? visitImportDirective(ImportDirective node) {
var sl = node.uri;
var importPath = sl.stringValue ?? "";
var fixedImportPath = fixer.import(importPath, at: filename);
if (fixedImportPath != importPath) {
if (_fixedImportPaths.containsKey(fixedImportPath)) {
addPatch(Patch.fromAstNode(node, replaceTo: ""));
return null;
}
addPatch(Patch.fromAstNode(sl, replaceTo: "'${fixedImportPath}'"));
_fixedImportPaths[fixedImportPath] = true;
}
return null;
}