-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharch.dart
44 lines (37 loc) · 1.03 KB
/
arch.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import 'dart:io';
void main() {
print('Generating Flutter architecture...');
// Root directory for Flutter project
const String rootDir = 'lib';
// Define the architecture structure
final Map<String, List<String>> directories = {
rootDir: ['core', 'features'],
'$rootDir/core': ['widgets', 'helper', 'common'],
};
// Create directories
directories.forEach((path, subDirs) {
createDirectory(path);
for (var subDir in subDirs) {
createDirectory('$path/$subDir');
}
});
print('Flutter architecture generated successfully!');
}
void createDirectory(String path) {
final directory = Directory(path);
if (!directory.existsSync()) {
directory.createSync(recursive: true);
print('Created directory: $path');
} else {
print('Directory already exists: $path');
}
}
void createFile(String path, String content) {
final file = File(path);
if (!file.existsSync()) {
file.writeAsStringSync(content);
print('Created file: $path');
} else {
print('File already exists: $path');
}
}