execv to replace the current process image with the
app executable. Dart starts again, but the process ID stays the same.
Preserve command-line arguments
The restarted app receives no original command-line arguments unless the runner registers them. If your app needs those arguments, add the header and call below tolinux/runner/main.cc, or linux/main.cc in older Flutter
projects. Keep the rest of main() unchanged:
restart_app_plugin. If
you use custom plugin wiring, add that link in linux/CMakeLists.txt after
include(flutter/generated_plugins.cmake):
Failed restarts
A successful response confirms that the request was accepted. Ifexecv
fails afterward, the plugin logs a warning and leaves the current app running.
Resolve the launch failure before retrying.