You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Misleading error message in positionInlineChildren assert #182090
When incorrectly implementing a custom InlineSpan, I encountered an assert inside the positionInlineChildren function with the following message:
The length of boxes (5) should be greater than childCount (1)
Looking only at this message, I would think my implementation is correct (5 is indeed greater than 1). However, the logic in the positionInlineChildren function expects the opposite: the number of boxes must NOT exceed the number of children (childCount).
@protectedvoidpositionInlineChildren(List<ui.TextBox> boxes) {
RenderBox? child = firstChild;
for (final box in boxes) {
if (child ==null) {
assert(
false,
'The length of boxes (${boxes.length}) should be greater than childCount ($childCount)',
);
return;
}
final textParentData = child.parentData!asTextParentData;
textParentData._offset =Offset(box.left, box.top);
child =childAfter(child);
}
while (child !=null) {
final textParentData = child.parentData!asTextParentData;
textParentData._offset =null;
child =childAfter(child);
}
}
The current message is logically incorrect and misleading for debugging.
@BrainLUX Thank you for pointing this out.
Could you please provide the exact assertion message you are currently seeing and what you believe would be more helpful? This helps us ensure the new message covers the specific edge case you hit.
@BrainLUX Thank you for pointing this out. Could you please provide the exact assertion message you are currently seeing and what you believe would be more helpful? This helps us ensure the new message covers the specific edge case you hit.
With pleasure.
I'm seeing exact message:
'The length of boxes (${boxes.length}) should be greater than childCount ($childCount)'
And I want to change it to
'The length of boxes (${boxes.length}) must not be greater than childCount ($childCount)'
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
saurabh-mirajkar commentedon Feb 10, 2026
@BrainLUX Thank you for pointing this out.
Could you please provide the exact assertion message you are currently seeing and what you believe would be more helpful? This helps us ensure the new message covers the specific edge case you hit.
BrainLUX commentedon Feb 10, 2026
With pleasure.
I'm seeing exact message:
And I want to change it to
to make it more clearer.
As I mentioned in #182093
saurabh-mirajkar commentedon Feb 11, 2026
@BrainLUX Thanks for the requested details.
Make positionInlineChildren assert much clearer (#182093)
Make positionInlineChildren assert much clearer (flutter#182093)
Make positionInlineChildren assert much clearer (flutter#182093)
github-actions commentedon Mar 11, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.