setVersion method

Future<void> setVersion({
  1. required Version version,
})

Implementation

Future<void> setVersion({
  required Version version,
}) async {
  final pubspec = this.pubspec;
  final pubspecContent = await pubspec.readAsString();
  final edited = pubspecContent.replaceFirst(
    'version: ${this.version}',
    'version: $version',
  );
  await pubspec.writeAsString(edited);
}