packagePathConvertFromFilePath method

String packagePathConvertFromFilePath(
  1. String filePath
)

Implementation

String packagePathConvertFromFilePath(String filePath) {
  final parts = filePath.split(r'/lib/');
  final fileForwardPart = parts.sublist(1).join('/lib/');
  final packageName = parts.first.split('/').last;
  final keyword = "package:$packageName/$fileForwardPart";
  CodeDisplayService().getScriptIdsWithKeyword(keyword);
  debugPrint(keyword);
  return keyword;
}