FlutterBasic 2 min read

Flutter hot reload vs hot restart: choose the right operation

Understand which changes preserve in-memory state, which need a Dart restart and which require rebuilding the platform app.

On this page

Hot reload updates supported Dart changes in a running app while preserving existing state. This makes it useful for interface iteration, but it also means initialization code is not automatically rerun.

Choose based on the changed layer

ChangeFirst operation to try
A label or build-method layoutHot reload
A value assigned during state initializationHot restart
A native plugin, permission or platform build settingStop and rebuild

Investigate state before blaming reload

Suppose a counter starts at zero in a state field. After several taps, changing the initializer to ten and reloading may leave the current count unchanged. The preserved state object already has a value. Restarting creates a new one.

Keep the feedback loop controlled

Make one small change and choose the operation appropriate to it. Deleting build output after every label change makes iteration slower and can hide which action actually fixed a problem.

Know the limit

Some changes cannot be applied through hot reload. Read the tool’s message rather than assuming the new code is active. Browser examples use their editor’s Run workflow, which differs from the local Flutter development loop.

Work through a state-preservation example

Suppose the app starts with count equal to zero. You tap twice, so the live State object now contains two. Changing the source initializer to ten does not necessarily replace that existing object during hot reload. The screen can correctly continue to show two even though the initializer in the file says ten.

Hot restart creates a new running Dart application state, so the new initializer becomes relevant. A native configuration change is another boundary: hot restart does not rebuild a platform permission declaration or install a new native plugin implementation.

When an update appears missing, check the tool’s feedback and the layer you changed before clearing caches. Practise this sequence with the first app : change a label, change a state initializer, then change a platform setting in a local project. Explain why the appropriate operation changes at each step.

Practice and verification

Run the counter locally, increase its value and modify its initializer. Compare reload with restart. Then change a build-method label and explain why that result is different.

How this topic connects

Understand first

Apply it next

Lesson progressMark complete after checking the example and exercise.

Find your next idea

Search lessons, code examples and projects.

Type a few words to start exploring.