addDevDependencies function

void addDevDependencies(
  1. List<String> devDependencies
)

Implementation

void addDevDependencies(List<String> devDependencies) async {
  for (var devDependency in devDependencies) {
    try {
      print('Adding $devDependency as a dev dependency...');
      var result = await Process.run('flutter', ['pub', 'add', devDependency, '--dev']);
      if (result.exitCode == 0) {
        print('Successfully added $devDependency');
      } else {
        print('Error adding $devDependency: ${result.stderr}');
      }
    } catch (e) {
      print('Failed to add $devDependency: $e');
    }
  }
}