ensureInsertedInto method

void ensureInsertedInto(
  1. BrownfieldSelection selection,
  2. DslWidget widget, {
  3. String? slot,
  4. int? index,
})

Inserts widget into the selected parent or slot.

Use slot for named containers like app bars; use index for stable ordering when appending is not sufficient.

Implementation

void ensureInsertedInto(
  BrownfieldSelection selection,
  DslWidget widget, {
  String? slot,
  int? index,
}) {
  _validateNamedWidget(widget, operation: 'ensureInsertedInto');
  _operations.add(
    _InsertIntoSpec(
      selection: selection,
      widget: widget,
      slot: slot,
      index: index,
    ),
  );
}