Skip to content
Related Articles

Related Articles

Improve Article

Difference Between Hot Reload and Hot Restart in Flutter

  • Last Updated : 08 Feb, 2021

When we build any dart application it takes time to execute for the first time. So to resolve this problem we have two features in a flutter, namely Hot Reload and Hot restart which helps to decrease the execution time of our app once we execute it.  These two features help to decrease the execution time. They are far better and faster than the default restart.  It is important to note that it can only be used if you have executed your program once.

Hot Reload

A hot reload is a great functionality present in a flutter. It is the easiest and the fastest function which helps you to apply changes, fix bugs, creating UIs, and add features. It takes approximately one second to perform its functionality. In hot reload it does not destroy the preserved state.  But you cannot use a hot reload once the app gets killed.

Perform Hot Reload:

  • Run your flutter editor from the app or using the command prompt. We can use hot reload in flutter debug mode.
  • Once your flutter project has been created do some changes in your code and perform a hot reload.
  • In windows, you can perform a hot reload using ‘ctrl+\’ or using the hot reload button. In mac devices, you perform hot reload using ‘cmd+s’. If you are working in the command prompt using flutter run enter ‘r’ to run.

Hot Restart

A hot restart has a slightly different functionality as compared to a hot reload. It is faster as compared to the full restart function. It destroys the preserved states of our app, and the code gets fully compiled again and starts from the default state. It takes more time as compared to hot reload but takes less time than the full restart function.

Perform Hot Restart:

  • Run your flutter editor from the app or using the command prompt.
  • Once your flutter project has been created do some changes in your code and perform a hot restart.
  • You can perform a hot restart using the hot reload button or pressing ctrl+shift+\.

Key Differences

Hot Reload

  • It performs very as compared to hot restart or default restart of flutter.
  • If we are using the state in our app then hot reload will not change the state of the app.
  • We perform hot reload by using key ctlr+\.

Hot Restart

  • It is slower than hot reload but faster than the default restart.
  • It doesn’t preserve the state of our it starts from the initial state of our app.
  • We perform hot restart using ctrl+shift+\
My Personal Notes arrow_drop_up
Recommended Articles
Page :