dryBaselineOf function
A child's dry baseline, or null where it has none.
getDryBaseline ASSERTS in debug for a render object that does not
implement computeDryBaseline -- Flutter's own RenderPositionedBox
is one, and an Align is what a page lowered to widgets is full of.
debugCheckingIntrinsics is the framework's OWN escape hatch: under it
debugCannotComputeDryLayout answers instead of throwing, and null is
the release answer anyway -- no baseline of its own, synthesise one
from the box. Catching the throw instead leaves the child's
_computingThisDryBaseline flag set for good, and every later size
access on it asserts.
AND THE HATCH IS OPENED ONLY WHERE THE QUESTION CAN REACH ONE. Under
debugCheckingIntrinsics Flutter keeps no intrinsic, dry layout or
dry baseline at all, so everything a question measures is measured
again each time it is asked, and every box under it that asks in turn
multiplies that: a price-table site's network tabs -- 245 chips in a flex
line, an inline-block alone on its line, two IntrinsicWidths round
it -- laid out in 17s at 390 in debug, against 2s with the hatch shut
where nothing asserts, and its width sweep held the build queue for
most of a day. So the hatch is opened only where something the question
can reach (_answersUnguarded) may answer by asserting; a question
asked under it already is asked as it is. Release builds never open
it.
Implementation
double? dryBaselineOf(RenderBox child, BoxConstraints constraints, TextBaseline baseline) =>
// Asked a baseline alone, an `IgnoreBaseline` answers none and asks
// nothing ([_answersUnguarded]).
child is RenderIgnoreBaseline
? child.getDryBaseline(constraints, baseline)
: _hatched(child, true, () => child.getDryBaseline(constraints, baseline));