moveConfigsToWorkspaceRootSync method
void
moveConfigsToWorkspaceRootSync({
- required String projectName,
- required Directory initialDirectory,
Moves configuration files from the Flutter app folder to the workspace root.
Moves .gitignore and analysis_options.yaml so they apply globally.
Parameters:
projectName: the name of the Flutter app folder.initialDirectory: the directory that was current before scaffolding. Throws:- Exception with message
⚠️ Failed to move configuration fileson failure.
Implementation
void moveConfigsToWorkspaceRootSync({
required String projectName,
required Directory initialDirectory,
}) {
log('🚚 Moving configuration files to workspace root...');
final files = ['.gitignore', 'analysis_options.yaml'];
for (final fileName in files) {
try {
final source = fs.file('$projectName/$fileName');
if (source.existsSync()) {
source.renameSync(fileName);
log('✅ Moved $fileName to workspace root');
}
} catch (_) {
throw Exception('⚠️ Failed to move $fileName');
}
}
}