addComponent function
Future<void>
addComponent(
- BuildContext context,
- AppModel app,
- String? componentName,
- EditorFeedback editorFeedback,
Implementation
Future<void> addComponent(BuildContext context, AppModel app,
String? componentName, EditorFeedback editorFeedback) async {
var appId = app.documentID;
if (componentName == null) {
openErrorDialog(app, context, '$appId/_error',
title: 'Problem', errorMessage: 'Component name is null');
} else {
var component =
Apis.apis().getRegistryApi().getComponentSpecs(componentName);
if (component == null) {
openErrorDialog(app, context, '$appId/_error',
title: 'Problem',
errorMessage: 'Component specs for $componentName not found');
} else {
component.editor.createNewComponent(app, context, editorFeedback);
}
}
}