containsAsset method
The function checks whether the asset is used in the code.
Implementation
Future<bool> containsAsset(String asset) async {
String currentPath = FileUtils.instance.getCurrentPath;
String libDirectory = "$currentPath/lib";
final libCodes = await _scanCodes(Directory(libDirectory));
for (var code in libCodes) {
final path = code.path.replaceAll(currentPath, "");
final content = File("$currentPath$path").readAsStringSync();
return content.contains(asset);
}
return false;
}