package:restart_app/restart_app.dart to use these types.
Restart.restartApp
Requests a restart or web reload and returns aFuture<RestartResult>.
mode to request another supported behavior. See configuration for parameter defaults and examples.
If your app has unsaved data, finish and await those writes before calling. The request can stop the Dart isolate or unload the browser document before later code finishes.
Web destinations
On web, onlyRestartMode.platformDefault is supported. webOrigin determines the destination:
Relative URLs resolve against
document.baseURI, including an HTML <base href> element. URLs match the same document when they are equal after removing their fragments. The default reload does not change the URL to your app’s initial route.
An app embedded in an iframe reloads its own frame.
Restart.restartCapability
Returns aFuture<RestartCapability> describing which restart behaviors the platform provides.
false. Missing plugin registration and platform-channel errors return unavailable capabilities. The reason field explains the failure when an explanation is available.
RestartMode
RestartResult
Native platforms may perform the restart after sending a successful result. A failure during that later work is written to native logs and cannot change the result already returned to Dart.
RestartCapability
Failures
Platform errors are returned asRestartResult values with success: false. Read code and message to decide how your app should respond.
Send one restart request per user action. Disable repeated taps as soon as the action starts. If the request fails, show the failure and let the user try again after addressing its cause.
Call from the main isolate. If you invoke the API before
runApp, first call WidgetsFlutterBinding.ensureInitialized(). See background isolates for worker coordination.