defaultComputeDistanceToHighestActualBaseline method Null safety

double? defaultComputeDistanceToHighestActualBaseline(
  1. TextBaseline baseline

Returns the minimum baseline value among every child.

Useful when the vertical position of the children isn't determined by the order in the child list.


double? defaultComputeDistanceToHighestActualBaseline(TextBaseline baseline) {
  double? result;
  ChildType? child = firstChild;
  while (child != null) {
    final ParentDataType childParentData = child.parentData! as ParentDataType;
    double? candidate = child.getDistanceToActualBaseline(baseline);
    if (candidate != null) {
      candidate += childParentData.offset.dy;
      if (result != null)
        result = math.min(result, candidate);
        result = candidate;
    child = childParentData.nextSibling;
  return result;