editPageOnLoad method

void editPageOnLoad(
  1. String name,
  2. List<DslAction> actions
)

Attaches page-load actions to an existing page.

The actions run on page entry (ON_INIT_STATE). If the page already has page-load actions, the provided actions replace them. This is a convenience wrapper around editPage + BrownfieldWidgetEditor.ensureActions.

app.editPageOnLoad('MyTrips', [
  FirestoreQuery(trips, limit: 20, outputAs: 'loadedTrips'),
  SetState('tripsList', ActionOutput('loadedTrips')),
]);

Implementation

void editPageOnLoad(String name, List<DslAction> actions) {
  editPage(name, (page) {
    page.ensureActions(
      page.root,
      triggerType: FFActionTriggerType.ON_INIT_STATE,
      actions: actions,
    );
  });
}