ensureAppBarActions method
Ensures one or more action widgets exist in the page app bar.
Implementation
void ensureAppBarActions({
required String page,
required List<DslWidget> actions,
}) {
if (actions.isEmpty) {
throw ArgumentError(
'ensureAppBarActions(...) requires at least one widget.',
);
}
raw((project) {
final editor = _pagePatternEditor(page);
final pageSnapshot = _requirePagePatternSnapshot(project, page);
_requireAppBar(pageSnapshot, operation: 'ensureAppBarActions');
for (var i = 0; i < actions.length; i++) {
final action = actions[i];
editor._validateNamedWidget(action, operation: 'ensureAppBarActions');
editor.ensureInsertedInto(
editor.slot('appBar'),
action,
slot: 'actions',
index: i,
);
}
_applyBrownfieldWidgetClassEdit(project, editor);
});
}