updateComponent function
Future<void>
updateComponent(
- BuildContext context,
- AppModel app,
- String? componentName,
- String? componentId,
- EditorFeedback editorFeedback,
Implementation
Future<void> updateComponent(
BuildContext context,
AppModel app,
String? componentName,
String? componentId,
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 {
if (componentId == null) {
openErrorDialog(app, context, '$appId/_error',
title: 'Problem',
errorMessage:
'Component $componentName with ID $componentId does not exist');
} else {
component.editor
.updateComponentWithID(app, context, componentId, editorFeedback);
}
}
}
}