feat: Add feature to programmatically restart the app in Flutter (fully close & reopen)
🔄 Add feature to programmatically restart the app in Flutter (fully close & reopen)
Description: I'm trying to implement a feature where the app restarts after a silent update is completed. Here's the flow:
- When the app starts, I check for updates every 15 seconds.
- If an update is available, I download and apply it silently without notifying the user.
- After the update is completed, I display a message to the user:
“We’ve made some changes. Please restart your app to see the updates.” - I provide a Restart button to the user.
🔁 The issue is: when I use existing restart packages (like restart_app or similar), the changes do not reflect after pressing the restart button. The only way the updates show is when the user manually closes and reopens the app from recent tasks.
What I’ve Tried:
- Using Flutter restart packages like
restart_app,flutter_phoenix, etc. - Hot restart-style logic using widget tree rebuilds.
- Wrapping the whole app with a restart widget and reloading it.
Expectation:
- I need a true restart — the app should completely close and reopen itself programmatically, similar to how a user would swipe the app away and tap it again from the launcher.
Request:
- Add a utility or method to fully restart the app programmatically on Android & iOS.
- Or if there are native workarounds (e.g., using platform channels or
ProcessPhoenixon Android), some guidance or example code would be appreciated.
Note: I’m using this for a production-level silent update flow, so reliability is important. Appreciate any tips, best practices, or Flutter-native solutions that could help.
I’ve hit a wall trying to solve this issue—so far, I haven’t found any viable workaround, which feels like a real deal‑breaker. I’d love to deploy this plugin in production, but it’s simply not practical until this problem is resolved.
Try using the https://pub.dev/packages/terminate_restart package, it worked well for me and fully restarted the application.