D
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

AspectHot ReloadHot Restart
Speed< 1 second2–5 seconds
State preservationState preservedState reset to initial
What triggers rebuildCalls build() on affected widgetsCalls main() again
When it failsinitState/dispose changes, type changesNever fails (full restart)
Use caseUI tweaks, layout changesLogic/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