save method

Future<void> save()

Saves pending changes to pubspec.yaml.

If changes were made, writes the updated configuration, runs dependency resolution, and resets the modification state.

Implementation

Future<void> save() async {
  if (!_modified) return;

  await _file.writeAsString(_editor.toString());
  final config = await ConfigService.load();
  await FlutterService(config).pubGet();
  _modified = false;
  LoggerService.success('pubspec.yaml updated.');
}