runWith<T> static method

T runWith<T>(
  1. T body(), {
  2. String? sessionId,
  3. String? cacheRetention,
})

Runs body with sessionId/cacheRetention overriding the cache routing of provider calls started inside it. An override is explicit: code that binds default routing values (the model-roles resolver) yields to an active override instead of replacing it.

Implementation

static T runWith<T>(
  T Function() body, {
  String? sessionId,
  String? cacheRetention,
}) {
  return runZoned(
    body,
    zoneValues: {
      _zoneKey: (sessionId: sessionId, cacheRetention: cacheRetention),
    },
  );
}