renderPubspecVersion function

String renderPubspecVersion(
  1. String content,
  2. String version
)

Renders a pubspec with its version updated while preserving other content.

Implementation

String renderPubspecVersion(String content, String version) {
  final editor = YamlEditor(content)..update(['version'], version);
  return editor.toString();
}