removeLayer method
Remove a layer from the editor.
This method removes a layer from the editor and updates the editing state.
Implementation
void removeLayer(int layerPos, {Layer? layer}) {
int oldIndex = activeLayers
.indexWhere((element) => element.id == (layer?.id ?? _tempLayer!.id));
if (oldIndex >= 0) {
stateHistory[stateManager.position].layers[oldIndex] =
_layerCopyManager.copyLayer(_tempLayer ?? layer!);
mainEditorCallbacks?.handleRemoveLayer(
stateHistory[stateManager.position].layers[oldIndex]);
}
var layers = _layerCopyManager.copyLayerList(activeLayers);
layers.removeAt(layerPos);
addHistory(layers: layers);
setState(() {});
}