updateFlutterAppPubspecSync method
Writes a workspace-aware pubspec.yaml for the Flutter app.
Parameters:
dartVersion: the Dart SDK constraint (e.g.3.10.8).projectName: the application name used as the package name in pubspec.
Implementation
void updateFlutterAppPubspecSync({
required String dartVersion,
required String projectName,
}) {
log('📝 Updating Flutter app pubspec.yaml...');
final content = '''
name: $projectName
description: "A new Flutter project."
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ^$dartVersion
resolution: workspace
dependencies:
flutter:
sdk: flutter
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
''';
final file = fs.file('$projectName/pubspec.yaml');
file.writeAsStringSync(content);
log('✅ Flutter app pubspec.yaml updated');
}