allocateNewLine method
Allocates and returns a new flex line cache.
Creates a new line, assigns it an index, and links it into the line chain. Ensures that the previous line (if any) has at least one child.
Implementation
FlexLineLayoutCache allocateNewLine() {
assert(
lastLine == null || lastLine!.debugChildCount > 0,
'last line must have at least one child',
);
final line = FlexLineLayoutCache();
line.lineIndex = lineCount;
if (firstLine == null) {
firstLine = line;
lastLine = line;
} else {
lastLine!.nextLine = line;
line.previousLine = lastLine;
lastLine = line;
}
lineCount++;
return line;
}