copyFolder function
Implementation
Future<void> copyFolder(
String sourcePath, String destinationPath, String widgetName) async {
Directory sourceDir = Directory(sourcePath);
Directory destDir = Directory(destinationPath);
if (!await destDir.exists()) {
await destDir.create(recursive: true);
}
List<FileSystemEntity> contents = sourceDir.listSync();
for (var entity in contents) {
if (entity is File) {
String newPath = path.join(destinationPath, path.basename(entity.path));
await entity.copy(newPath);
}
}
}