onTapSaveChanges method

void onTapSaveChanges(
  1. String actionText
)

Implementation

void onTapSaveChanges(String actionText) {
  if (actionText.startsWith("collection")) {
    String? serviceUrl = actionText.replaceAll("collection:", "");
    String? modelName = serviceUrl.split(".")[0];
    String? collection = serviceUrl.split(".")[1];

    executeAddToCollection(modelName, collection);
  } else if (actionText.startsWith("action")) {
    String? serviceUrl = actionText.replaceAll("action:", "").trim();
    String? modelName = serviceUrl.split(".")[0];
    String? actionName = serviceUrl.split(".")[1];

    executeAction(modelName, actionName);
  } else {
    ScaffoldMessenger.of(context).showSnackBar(SnackBar(
      content: Text(localizedText('Invalid save configuration')),
    ));
  }
}