Flutter CoreBeginner10 XP2 min read
What is the difference between Hot Reload and Hot Restart?
TL;DR: Hot Reload injects updated Dart code into the running VM and calls build() again without resetting state; Hot Restart rebuilds the entire app from scratch, resetting all state.
Full Answer
| Aspect | Hot Reload | Hot Restart |
|---|---|---|
| Speed | < 1 second | 2–5 seconds |
| State preservation | State preserved | State reset to initial |
| What triggers rebuild | Calls build() on affected widgets | Calls main() again |
| When it fails | initState/dispose changes, type changes | Never fails (full restart) |
| Use case | UI tweaks, layout changes | Logic/state initialization changes |
💡
Hot Reload works by patching the Dart VM's class definitions and calling reassemble() on the root widget. State in StatefulWidget's State objects is preserved across hot reloads.
Interview Tip
💡
Hot Reload only re-runs build() — it doesn't re-run initState(). If your bug is in initialization code, use Hot Restart. If your change is in the build tree, use Hot Reload.
#hot-reload#hot-restart#development#dart-vm