Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restart app with button in flutter

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 ?


1 Answers

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

like image 129
Sapto Sutardi Avatar answered Oct 25 '25 19:10

Sapto Sutardi