Many programming languages support updating the running program but these all suffer from limitations that make using the feature difficult and error prone. The Dart VM’s hot reload is safe and fast. First, we designed the system to be safe and be reversible. If we detect issues at reload time, the VM will restore the original source code as if nothing happened. It’s fast because you can import new libraries, create new classes, and even add fields to existing classes without restarting your application.
Flutter works naturally with hot reload and you can see your changes on your mobile device in less than a second. And because we reload the changes into the running app, you don’t need to waste time navigating back to where you were in the app. We measure our development cycle in milliseconds!
In our talk we share some technical information on the implementation and do a deep dive on the semantics of Dart during a reload.
Some of the questions covered in the talk are:
- What happens to static data?
- What if functions are already on the stack when a reload occurs?
- How do you handle adding an instance field to classes that have instantiated objects?
Posted by John McCutchan & Todd Turnidge, Hot Reloaders