inflate<T extends InflatedChildHandle> method
Dynamically inflates a widget as a child, should only be called during layout inside performInflatingLayout.
Implementation
T inflate<T extends InflatedChildHandle>(Widget widget, {Object? id}) {
id ??= _indexedChildCount++;
assert(() {
if (childHandleMap.containsKey(id)) {
throw FlutterError(
'This boxy attempted to inflate a widget with a duplicate id.\n'
'There is already a child with the id "$id"');
}
debugChildrenNeedingLayout.add(id!);
return true;
}());
final child = childFactory<T>(id: id, parent: this, widget: widget);
_inflateQueue.add(child as ChildHandleType);
childHandles.add(child);
childHandleMap[id] = child;
_didInflate = true;
return child;
}