4

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 ?

4

3 Answers 3

5

The best solution... using "Restart App" module

  1. Instal from your teminal:

flutter pub add restart_app

  1. Import from your dart file:

import 'package:restart_app/restart_app.dart';

  1. Call "Restart App" from your Button:

onPressed: () { Restart.restartApp();}

Have a nice day...

Sign up to request clarification or add additional context in comments.

1 Comment

Just as an update, the package is updated to v1.2.0 and now it supports iOS as well.
0

Use this package https://pub.dev/packages/flutter_phoenix and call Phoenix.rebirth(context); when you want to reload the app

1 Comment

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.