save method

void save(
  1. Map<String, dynamic> pubspec
)

Writes the pubspec.yaml file with the given pubspec.

Throws a FileSystemException if there is an error writing the file.

Implementation

void save(Map<String, dynamic> pubspec) {
  final file = File(_filepath);
  final yamlWriter = YamlWriter();
  final updatedYaml = yamlWriter.write(pubspec);

  try {
    file.writeAsStringSync(updatedYaml);
  } catch (e) {
    throw FileSystemException('Error writing YAML file: $e');
  }
}