Currently, I was working on React Native Project, and when I shake the Phone after Running Project it gives me live Updates. as I've also worked with Flutter it also provides me the Same kind of OutPut. but, In Android there is a Functionality called Instant Run.
I've googled Instant Run. and Some of the Results differs Instant Run is not Hot Reload for Android Studio.
so, I want to Know what is the Significant Difference in Working and Feature of Instant Run and Hot Reload?
I can't go into technical details, but here are a few practical differences:
There is actually very little difference between how Flutter's Hot Reload and Android Studio's Instant Run work.
They both check for code changes, do a compilation step only on what has changed, and then send it to the phone to be run. Both the Android and Flutter apps run a VM (jvm, or dart vm) which is capable of changing classes on the fly.
When you do a Flutter Hot Reload it is doing a quick incremental compilation step and then sending your dart code to the phone where it is run pretty much instantaneously. This is so fast partly because Flutter uses a JIT model of compilation when running in debug mode, which means that less time is spent compiling but that the first run (or first few runs) of a method might not be optimized. State is persisted between changes in many cases because of the way flutter works, not through anything innate to the dart JIT processing. And for some things (static & initState functions come to mind), you actually have to do a Full Reload which re-initializes the app's state, but is still almost instant.
What Android Studio for Instant Run is pretty similar, but is always fully compiled. The VM has some instrumentation so that when a method is called, the VM checks if a new class has been injected. Instant Run will do it's best to replace as little as possible; if it can simply replace some of the classes it will, but it often needs to replace the entire activity and sometimes the entire app. Here's a good diagram from this blog (which is worth a read if you want a deeper understanding):
Functionally, Instant Run and Hot Reload should be pretty similar. However, in practice I've found that flutter's Hot Reload is quite a lot faster than Instant Run, especially for an app of any size.
Furthermore, I have found that the way flutter deals with States lends itself much better to recomputed classes than the way Android's activities work. In Flutter, you have many classes involved with the UI each with their own state, and changing just a couple of them is pretty quick. Alternatively, with Android you tend to have larger Views or Activity UI which takes more effort to replace and often result in reloading activities rather than simply a class here and there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With