Check Mobile App
Read now
Start a Project

Reload / Restart app in flutter

Save

In this blog, we will see how to reload/restart the flutter app. Actually, I have many ways and pub packages to restart the app and found this way to be the best to reload the app using just a few blocks of codes. In my code, I wrap the whole app into a statefulwidget. And when you want to restart the app, rebuild that stateful widget with a child that possesses a different Key. If you want to use a package then you can use the flutter_phoenix package.
Let’s Start the implementation part.
First, I will create a RestartWidget. This class contain the whole app. The UniqueKey always return a unique value which proves the widget a unique id.

Now we will call the RestartWidget from Main method in the code.

Now, call restartApp method from anywhere in the code it will restart the application.

Restart/Reload app in flutter

Note: The above code makes you lose the whole state of your app.

In conclusion, I hope this code will help you better understand Restart/Reload app in a flutter. If you feel any doubt or queries please comment below.

Thanks for the read this blog and if you want to visit my other blogs click here.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

css.php

When I think in getting solutions for my Ecommerce Platform, I think of Webkul. They have been such a blessing in our business. We have spent thousands of dollars in support and modules from them. We love their support team. They work very closely with us, and they always go the extra mile when we need help.

Michael Urresta

Michael Urresta

Talk to Sales

Global

Live Chat
Start a Project

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home