I have a setting screen, when I change FontFamily it needs to restart the app to change all app fonts, And it restarts after the app closed, but I want to restart the app with a button instead of closing the app. does there any way to do this ?
Asked
Active
Viewed 6,431 times
4
-
Hello - which IDE are you using ? VsCode ? Android Studio ? Are you running using debug mode ? – Aristidios Jul 23 '21 at 20:49
-
Iam using VsCode and running with debug mode – Jul 23 '21 at 21:40
-
Here you will find your answer https://stackoverflow.com/questions/50115311/flutter-how-to-force-an-application-restart-in-production-mode – ahmed-m-abdelfatah Jul 24 '21 at 02:05
-
Does this answer your question? [Flutter: how to force an application restart (in production mode)?](https://stackoverflow.com/questions/50115311/flutter-how-to-force-an-application-restart-in-production-mode) – Jannie Theunissen Mar 03 '22 at 06:18
3 Answers
5
The best solution... using "Restart App" module
- Instal from your teminal:
flutter pub add restart_app
- Import from your dart file:
import 'package:restart_app/restart_app.dart';
- Call "Restart App" from your Button:
onPressed: () { Restart.restartApp();}
Have a nice day...

Sapto Sutardi
- 326
- 4
- 11
-
Just as an update, the package is updated to v1.2.0 and now it supports iOS as well. – Hossein Yousefpour May 30 '23 at 14:11
0
Use this package https://pub.dev/packages/flutter_phoenix and call Phoenix.rebirth(context); when you want to reload the app

Rinu Thomas
- 71
- 3
-
2Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 14 '22 at 01:29
0
I have implemented the https://pub.dev/packages/flutter_phoenix package in my app, to restart the app wrap widget with Phoenix on the line of code:
runApp(Phoenix(child: MyApp()))
wherever you want to restart the app just implement this line of code
Phoenix.rebirth(context);
hope this help

J.Jayus
- 1
- 1