Skip to content

Repository files navigation

restart_app

pub package likes pub points

Restart your Flutter app from Dart on Android, iOS, web, macOS, Linux, and Windows.

Documentation · API reference · Example

Features

  • 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.

Quick start

Requires Flutter 3.22 or later and Dart 3.4 or later.

flutter pub add restart_app

Import 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.

Platforms

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.

iOS setup

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.

Web routes

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.

AI agent skills

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_app

Select 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.

Documentation

Author

Created by Soroush Yousefpour

Buy me a coffee

About

A Flutter plugin to restart or relaunch Flutter apps with platform-specific behavior, including opt-in iOS Flutter engine restart.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

129 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages