You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Plugins in standalone flutter apps typically live as long as the application is alive. However, in add2app use case, we would want to be able to free the resources and destroy the plugin if the isolate backing the plugin is no longer active (e.g. if FlutterView is destroyed). In some cases, this can be done by subscribing to the activity lifecycle (e.g. if the Flutter is added as a separate activity) but most often the plugin is attached to a single view.
We need a way to detect that the isolate (i.e. FlutterNativeView) is being destroyed.
Incidentally, there is also #19358 tracking calling dispose() on the widget tree when containing FlutterView gets destroyed. This would allow plugins to release resources acquired per widget instantiation (for plugins implementing widgets) in a fashion symmetrical with resources acquisition.
@mehmetf does this need to apply to the old embedding, or just the new one?
In either case, can you describe what the definition of done should look like? For example, should all 1P plugins actually free up their resources to consider this ticket done? Or is there a more narrow interpretation of this ticket that could be handled just by the embedding?
Ok. Moving forward, plugins will be capable of being unregistered. They will be notified of this. Also, if the FlutterEngine that they are attached to is disposed of, all plugins will automatically be unregistered from that FlutterEngine first. Is that sufficient?
I'm going to close this ticket now that enough of the plugin API has been merged to facilitate plugin resource cleanup when the FlutterEngine is destroyed.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
nichtverstehen commentedon Aug 24, 2018
My understanding was that plugins can subscribe to view destroy events via
Registrar.addViewDestroyListener.Incidentally, there is also #19358 tracking calling
dispose()on the widget tree when containingFlutterViewgets destroyed. This would allow plugins to release resources acquired per widget instantiation (for plugins implementing widgets) in a fashion symmetrical with resources acquisition.matthew-carroll commentedon Mar 20, 2019
@mehmetf does this need to apply to the old embedding, or just the new one?
In either case, can you describe what the definition of done should look like? For example, should all 1P plugins actually free up their resources to consider this ticket done? Or is there a more narrow interpretation of this ticket that could be handled just by the embedding?
mehmetf commentedon Mar 20, 2019
If this is already there, this ticket can be closed.
No. The title is poorly worded. This is about embedder capability. Embedder needs to be able to signal to the plugin to clean up its resources.
matthew-carroll commentedon Mar 20, 2019
Ok. Moving forward, plugins will be capable of being unregistered. They will be notified of this. Also, if the FlutterEngine that they are attached to is disposed of, all plugins will automatically be unregistered from that FlutterEngine first. Is that sufficient?
mehmetf commentedon Mar 20, 2019
Yes.
matthew-carroll commentedon May 23, 2019
I'm going to close this ticket now that enough of the plugin API has been merged to facilitate plugin resource cleanup when the
FlutterEngineis destroyed.github-actions commentedon Aug 30, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.