anchor.diff:      final pubCacheDir = Directory(p.join(temp.path, 'pub-cache'));
       await pubCacheDir.create();
   
  +    final toolEnv = await ToolEnvironment.create(
  +      dartSdkDir: envConfig.toolEnvDartSdkDir,
  +      flutterSdkDir: envConfig.flutterSdkDir,
  +      pubCacheDir: pubCacheDir.path,
  +    );
  +
       for (final package in profile.packages) {
         final versions = package.versions == null || package.versions.isEmpty
             ? <String>['any']
  
positive.code:   });
  }
  
  String _generateDummyPubspec(String package, String version) {
    return json.encode(
      {
        'name': '____dummy____',
        'environment': {
          'sdk': '>=2.7.0 <3.0.0',
        },
        'dependencies': {
          package: version,
  
negative.code:         await dummyDir.create();
  
          final pubspecFile = File(p.join(dummyDir.path, 'pubspec.yaml'));
          await pubspecFile.writeAsString(_generateDummyPubspec(
            package.name,
            version,
            minSdkVersion: toolEnv.runtimeInfo.sdkVersion,
          ));
  
          final pr = await toolEnv.runUpgrade(dummyDir.path, false);
          if (pr.exitCode != 0) {
            throw Exception(
                'pub get on `${package.name} $version` exited with ${pr.exitCode}.\n${pr.stderr}');
  