PubCache.forScope constructor

PubCache.forScope()

Use this ctor to alter the location of .pub-cache during testing.

    withEnvironment(() {
  /// create a pub-cache using the test scope's HOME
  Scope()
    ..value(PubCache.scopeKey, PubCache.forScope())
    ..run(() {
        // do stuff
      });
    });
}, environment: {
  'PUB_CACHE': join(outerTempDir, 'test_cache', '.pub-cache')
});

Implementation

factory PubCache.forScope() => PubCache._internal();