CodeBlanks Logo Icon CodeBlanks

Hot reload

Learn what hot reload does and why it is essential.

Hot reload

Hot reload updates the app within seconds when you edit and save code, without restarting it. State is preserved; form data, scroll position and counters do not disappear. It is the most used feature during development.

# while flutter run is active, press 'r'
$ flutter run
# For hot reload: r
# For hot restart: R

Hot restart and DevTools

Hot restart (with R), unlike hot reload, resets all state and restarts the app from scratch; the widget tree is re-instantiated. Flutter DevTools offers advanced debugging tools such as performance profiling, widget tree inspection and network request monitoring.

# flutter run interactive keys:
# r = hot reload (state preserved)
# R = hot restart (state reset)
# q = quit

# Open DevTools in the browser:
$ flutter pub global run devtools

Practice Print reload info

In main, print two lines with print: reload state korur and restart state sifirlar.

Starter code

main.dart
void main() {
  // iki satır yazdır:
  // reload state korur
  // restart state sifirlar

}

Sample solution

main.dart
void main() {
  print('reload state korur');
  print('restart state sifirlar');
}

Expected output

reload state korur
restart state sifirlar

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What state does hot reload preserve?

  • Buffer memory
  • App state Correct answer
  • Build output
  • Network packets

Explanation: Hot reload preserves app state while applying changes; restart resets it.

2 Hot reload key

Question
# hot reload: ____
# hot restart: R
Answer
# hot reload: r
# hot restart: R

Explanation: In flutter run interactive mode, 'r' does hot reload, 'R' does hot restart.

3 Hot reload and restart

Term Meaning
Hot reload Applies changes while preserving state
Hot restart Resets state and restarts
r tuşu Triggers hot reload
DevTools Profiling and debugging tools

All lessons in Beginner