addDocumentImport static method
void
addDocumentImport(
- Element element,
- BuildStep buildStep
解析注释中的import信息 简单处理规则->'import '开头,';'结尾的认为是import信息
Implementation
static void addDocumentImport(Element element, BuildStep buildStep) {
if (element.documentationComment != null) {
List<String> comments = element.documentationComment!.split('\n');
for (String elem in comments) {
String info = elem;
String prefix = 'import \'';
String suffix = '\';';
if (info.contains(prefix)) {
info = info.substring(info.indexOf(prefix));
if (info.startsWith(prefix) && info.endsWith(suffix)) {
ApiGenerator.addImport(buildStep,
info.substring(prefix.length, info.length - suffix.length));
}
}
}
}
}