To hot reload a Flutter app:
- Run the app from a supported flutter editor or a terminal window. Either a physical or virtual device can be the target. Only Flutter apps in debug mode can be hot reloaded.
- Modify one of the Dart files in your project. Most types of code changes can be hot reloaded; for a list of changes that require a hot restart, see special cases .
- If you’re working in an IDE/editor that supports Flutter’s IDE tools, select Save All (
ctrl-s), or click the hot reload button on the toolbar.If you’re running the app at the command line using
flutter run, enter
rin the terminal window.
After a successful hot reload operation, you’ll see a message in the console similar to:
Performing hot reload… Reloaded 1 of 448 libraries in 978ms. How hot-reload works. When hot-reload is invoked, the host machine checks the edited code since last compilation and recompile the following libraries: Any library with changed code. The application’s main library. The libraries from the main library leading to affected libraries. The updated source codes are sent into a running Dart Virtual Machine. The Dart VM then reloads all the libraries with updated code, The hot-reload mechanism updates classes with the new versions of fields and functions, the Flutter framework automatically rebuild, repaint ,re-layout the widget tree, allowing one to quickly view the effects of the changes.