withMetrics<T> static method
Runs body with an explicit metrics scope (save/restore), mirroring
DimenCache.withMetrics.
Implementation
static T withMetrics<T>(DimenMetrics metrics, T Function() body) {
final previous = _slot;
final previousContext = _contextSlot;
_slot = metrics;
_contextSlot = null;
try {
return body();
} finally {
_slot = previous;
_contextSlot = previousContext;
}
}