shorebird icon indicating copy to clipboard operation
shorebird copied to clipboard

feat: Add feature to programmatically restart the app in Flutter (fully close & reopen)

Open parth-darji opened this issue 8 months ago • 3 comments

🔄 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:

  1. When the app starts, I check for updates every 15 seconds.
  2. If an update is available, I download and apply it silently without notifying the user.
  3. 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.”
  4. 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 ProcessPhoenix on 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.

parth-darji avatar Apr 16 '25 12:04 parth-darji

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.

Vingtoft avatar Apr 16 '25 19:04 Vingtoft

Try using the https://pub.dev/packages/terminate_restart package, it worked well for me and fully restarted the application.

LucazzP avatar Apr 17 '25 12:04 LucazzP