getImportStrings method
Implementation
List<String> getImportStrings(String? relativePath) {
var prefix = '';
if (relativePath != null) {
final matches = RegExp(r'\/').allMatches(relativePath).length;
String addPrefix(_) => prefix = '$prefix../';
List.filled(matches, (i) => i).forEach(addPrefix);
}
return imports.where((element) => element.isNotEmpty).map((e) {
if (e.startsWith('package')) {
return "import '$e';";
}
return "import '$e.dart';";
}).toList();
}