parseImportLine function
Parse the import line to get the package or file path.
Implementation
String? parseImportLine(String line) {
var openQuote = false;
var importPath = '';
for (var char in line.split('')) {
if (openQuote == false && (char == "'" || char == '"')) {
openQuote = true;
continue;
}
if (openQuote == true && (char == "'" || char == '"')) {
break;
}
if (openQuote == true) {
importPath += char;
}
}
if (importPath.isEmpty || !line.endsWith(';')) {
return null;
}
return importPath;
}