getImportStrings method

List<String> getImportStrings(
  1. String? relativePath
)

Implementation

List<String> getImportStrings(String? relativePath) {
  var prefix = '';

  if (relativePath != null) {
    final matches = RegExp(r'\/').allMatches(relativePath).length;
    List.filled(matches, (i) => i).forEach((_) => prefix = '$prefix../');
  }

  return imports.where((element) => element.isNotEmpty).map((e) => "import '$prefix$e.dart';").toList();
}