Restart your Flutter app from Dart on Android, iOS, web, macOS, Linux, and Windows.
Documentation · API reference · Example
- App and process restarts on Android and desktop.
- Flutter engine restarts on iOS, with native setup.
- Flutter web app restarts with JavaScript and WebAssembly support.
- Restart results, error details, and platform capability checks.
- Bundled AI agent skills for integration and iOS configuration.
Requires Flutter 3.22 or later and Dart 3.4 or later.
flutter pub add restart_appImport the package and call it from a button or another app action:
import 'package:restart_app/restart_app.dart';
await Restart.restartApp();iOS: complete the AppDelegate setup before using this call.
The method returns a RestartResult with success or error details. See error handling for an example.
Restart.restartApp() uses the following default behavior:
| Platform | What happens |
|---|---|
| Android | Relaunches the app's main activity. Use RestartMode.process to also restart the process. Android TV and Fire TV are supported. |
| iOS | Recreates the Flutter engine and starts the Flutter app again within the existing iOS process. Requires the setup below. |
| Web | Reloads the whole Flutter web app at the same URL. |
| macOS | Opens a new app instance and asks the existing instance to quit. |
| Linux | Runs the app executable again, replacing the existing process without changing its process ID. |
| Windows | Opens a new app process and ends the existing process. |
Add the plugin registration callback to ios/Runner/AppDelegate.swift so the new Flutter engine can use your app's plugins. The iOS guide has complete examples for UIScene and older AppDelegate projects.
iOS restarts the Flutter engine, not the entire native process. Native singletons remain in memory. The optional notification fallback closes the app and requires a notification tap to reopen it.
A restart reloads the whole Flutter web app. The browser URL stays the same, so an app opened at /settings restarts at /settings, where your router decides what to show.
To restart at another route, pass webOrigin:
await Restart.restartApp(webOrigin: '/');Here, / is the website root. Apps hosted in a subdirectory should use that path, such as /my-app/. Hash routing is also supported with values such as #/home. See web destinations.
The package includes two skills that help AI coding agents use the restart API and configure iOS engine restarts. Install them from your Flutter project with Dart 3.12 or later:
dart run skills@ get restart_appSelect the skills when prompted. Run the command again after upgrading the package to update your agent's instructions. See the agent skills guide for other installation options.
- Requirements: Flutter, native OS, and build tool versions.
- Platform behavior: restart modes and platform limits.
- Configuration: saved data, web routes, and restart options.
- Background isolates: request a restart from a worker.
- Linux arguments: keep command-line arguments after a restart.
Created by Soroush Yousefpour