getAllFilePaths static method
Implementation
static Future<List<String>> getAllFilePaths(String folderPath) async {
List<String> filePaths = [];
// Get the list of files and directories within the folder
final directory = Directory(folderPath);
final entities = directory.listSync();
for (var entity in entities) {
// Check if the entity is a file
if (entity is File) {
filePaths.add(entity.path);
}
// If it is a directory, recursively call the same function
else if (entity is Directory) {
filePaths.addAll(await getAllFilePaths(entity.path));
}
}
return filePaths;
}