editPage method

void editPage(
  1. String name,
  2. void build(
    1. BrownfieldWidgetEditor component
    )
)

Queues rerunnable structural edits against an existing page.

The name must already exist in the target project. The closure only records intent; selectors resolve later against the latest project snapshot during compilation, so edits stay stable across repeated runs.

Implementation

void editPage(String name, void Function(BrownfieldWidgetEditor page) build) {
  recordExistingReference(
    name: name,
    kind: 'page',
    referenceApi: 'editPage',
    removeApi: 'removePage',
  );
  final editor = BrownfieldWidgetEditor._(
    scopeKind: _WidgetClassScopeKind.page,
    widgetClassName: name,
  );
  build(editor);
  raw((project) => _applyBrownfieldWidgetClassEdit(project, editor));
}