getDependencies method
Returns the dependencies and dev_dependencies maps from the target project's pubspec.
Returns (null, null) if the pubspec cannot be read.
Implementation
Future<(YamlMap?, YamlMap?)> getDependencies({required String workingDirectory}) async {
try {
final content = await File('$workingDirectory/pubspec.yaml').readAsString();
final doc = loadYaml(content) as YamlMap;
final dependencies = doc['dependencies'] as YamlMap;
final devDependencies = doc['dev_dependencies'] as YamlMap;
return (dependencies, devDependencies);
} catch (e) {
CommandHelper().error('Could not get dependencies: $e');
return (null, null);
}
}