editComponentState method

void editComponentState(
  1. String name,
  2. void build(
    1. BrownfieldStateEditor state
    )
)

Ensures component-local state fields exist on an existing component.

Implementation

void editComponentState(
  String name,
  void Function(BrownfieldStateEditor state) build,
) {
  recordExistingReference(
    name: name,
    kind: 'component',
    referenceApi: 'editComponentState',
    removeApi: 'removeComponent',
  );
  final editor = BrownfieldStateEditor._(widgetClassName: name);
  build(editor);
  raw((project) => _applyBrownfieldStateEdit(project, editor));
}