When using Pub workspaces for monorepos, pubspec.lock is not generated in packages.
So, the following handling is needed.
final pubspecLockFile = File('$currentPath/pubspec.lock');
if (pubspecLockFile.existsSync()) {
final pubspecLock = loadYaml(pubspecLockFile.readAsStringSync());
dependencies.addAll(pubspecLock['packages'].keys);
}
When using Pub workspaces for monorepos, pubspec.lock is not generated in packages.
So, the following handling is needed.