updateFlutterAppPubspecSync static 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
static void updateFlutterAppPubspecSync({
required String dartVersion,
required String projectName,
}) {
print('📝 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 = File('$projectName/pubspec.yaml');
file.writeAsStringSync(content);
print('✅ Flutter app pubspec.yaml updated');
}