destroyBuffer method
Destroy the path buffer for a window and layer.
Implementation
void destroyBuffer(String windowId, {int layerId = 0}) {
if (!_initialized) return;
final layerBuffers = _buffers[windowId];
final layerFrames = _frameIds[windowId];
layerBuffers?.remove(layerId);
layerFrames?.remove(layerId);
if (layerBuffers != null && layerBuffers.isEmpty) {
_buffers.remove(windowId);
}
if (layerFrames != null && layerFrames.isEmpty) {
_frameIds.remove(windowId);
}
final idPtr = windowId.toNativeUtf8().cast<Char>();
try {
if (_destroyBufferLayer != null) {
_destroyBufferLayer!(idPtr, layerId);
} else if (layerId == 0) {
_destroyBuffer(idPtr);
}
} finally {
calloc.free(idPtr);
}
}