removeFunction method

void removeFunction({
  1. required String functionUuid,
})

Implementation

void removeFunction({
  required String functionUuid,
}) {
  if (canvasController.currentCanvasListenable.value.functionUuid ==
      functionUuid) {
    canvasController.currentCanvas = projectModel.functionsCanvas.first;
  }
  projectModel.functionsCanvas.remove(projectModel.functionsCanvas
      .firstWhere((element) => element.functionUuid == functionUuid));
  canvasController.functionsListListenable.value =
      projectModel.functionsCanvas.where((element) => true).toList();
  onProjectChange?.call(projectModel);
}