I'm writing a small flutter plugin which might currently "crash" the app, if a hot restart occurs. I suspect this is due to my plugin attempting to open a (midi) port that was already opened in a previous run.
So I'm looking for a function that is called right before a hot restart so I can close said resources.
So far I tried flutters ActivityAware
Interface but none of the onDetachedFromActivityForConfigChanges
, onDetachedFromActivity
as well as the plugins default onDetachedFromEngine
are fired.
Is there a way to achieve this?