addDependencies function

void addDependencies(
  1. List<String> dependencies
)

Implementation

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