Line data Source code
1 : import 'package:analyzer/dart/element/element.dart'; 2 : 3 : /// Extension on Element to make extracting non trivial information simple 4 : extension ElementExtensions on Element { 5 : /// Extracts the import statement from an Element 6 0 : String get importStatement { 7 0 : final source = librarySource ?? this.source!; 8 : 9 0 : return source.uri.toString(); 10 : } 11 : 12 : /// Extracts the import statements of a file 13 0 : List<String> get dependencies { 14 0 : return library!.importedLibraries 15 0 : .map((lib) => lib.location.toString()) 16 0 : .toList(); 17 : } 18 : }