writePubspecContent static method
Write a new content to the pubspec.yaml file
Implementation
static void writePubspecContent(
String newContent,
dynamic newVersionName,
dynamic newBuildNumber,
) {
final pubspecFilePath = p.join(Directory.current.path, 'pubspec.yaml');
final pubspecFile = File(pubspecFilePath);
try {
pubspecFile.writeAsStringSync(newContent);
print(
'Success: Updated version to $newVersionName${newBuildNumber != null ? '+$newBuildNumber' : ''}',
);
} on FileSystemException catch (e) {
stderr.writeln('Error writing to pubspec.yaml: ${e.message}');
}
}