updatePubspecAssets function

void updatePubspecAssets(
  1. List<String> assetPaths, {
  2. String? pubspecPath,
})

Updates pubspec.yaml with asset paths

Implementation

void updatePubspecAssets(List<String> assetPaths, {String? pubspecPath}) {
  final path = pubspecPath ?? 'pubspec.yaml';
  final file = File(path);

  if (!file.existsSync()) {
    throw Exception('pubspec.yaml not found at: $path');
  }

  final content = file.readAsStringSync();
  final updatedContent = _updateFlutterAssetsSection(content, assetPaths);

  file.writeAsStringSync(updatedContent);
}