destroy method
void
destroy(
{ - Function? onDestroyed,
})
override
Implementation
@override
void destroy({Function? onDestroyed}) {
if(onDestroyed != null) {
onDestroyCallback = onDestroyed;
}
ReceivePort rPort = ReceivePort();
rPort.listen((message) {
csoundAndroidStop(_cs);
csoundAndroidDestroy(_cs);
_controlChannelCallbacks.forEach((key, value) {
malloc.free(value.cName);
});
_audioChannelCallbacks.forEach((key, value) {
if(value.cName != null && value.cName != nullptr) malloc.free(value.cName!);
});
_controlChannelCallbacks = {};
_audioChannelCallbacks = {};
_isolate.kill();
onDestroyCallback.call();
});
_sendPort.send([{MessageTag.MESSAGE_TYPE: MessageType.DELETE}, rPort.sendPort]);
}