wrapPhase<T> method
Wraps func
with a new debugPhase.
This is used by subclasses to indicate what phase in the render pipeline the boxy is performing.
Implementation
T wrapPhase<T>(
BoxyDelegatePhase phase,
T Function() func,
) {
// A particular delegate could be called reentrantly, e.g. if it used
// by both a parent and a child. So, we must restore the context when
// we return.
final prevRender = this;
delegate._render = this;
debugPhase = phase;
try {
return func();
} finally {
debugPhase = BoxyDelegatePhase.none;
delegate._render = prevRender;
}
}