Flutter - How to add hot reload on save with nano editor? - linux

My 8 gig ram machine can't handle a VM and building a flutter project simultaneously in vscode. So I've decided to go with nano editor. It does the job, but everytime I want hot reload, I have to manually go to the terminal where I'm running flutter run and hit r there. Is there a way to set hot reload on save like that of vscode?

Related

Editor Opens main.dart on Save

Have a flutter web project being developed using Android Studio and something has changed recently which is now causing Android Studio to open up the file main.dart in the editor pane whenever a file is saved while the project is running in chrome.
Say the project is made up of two dart files: main.dart and example.dart and I have only the file example.dart open in the editor. I then click run 'main.dart which causes the application to launch in chrome browser. If I then make a change in example.dart while the app is running and save the file, the main.dart file is automatically opened in Android Studio's editor pane and gets the focus. This is forcing me to have to switch back to the example.dart file each time I want to make another change to it.
Not sure if it is Android Studio doing this or flutter itself as part of its hot reload functionality. Or maybe something I clicked on by mistake making it do this?
Did a flutter upgrade and the issue has now gone away so maybe the problem was somewhere in flutter web's Hot Reload functionality.

Flutter App in Android Studio doesn't get updated on virtual device by hot reload or hot restart

I have an flutter app that I'm working on in Android Studio on a Windows 10 machine.Android Studio and the flutter SDK are the lastest stable versions.
I'm running an Pixel 2 phone as AVD to test the app but suddenly hot reload and hot restart won't update the app anymore.
For instance if I change the Icon of an Floating Action Button the icon normally changed after a hot reload or hot restart.
Now changes are only visible after I a cold restart.
It seems like the hot restart/hot reload don't update the app on the virtual device.
I tried running the hot reload from the console, but that doesn't work either.
I reseted the AVD, created a new one and even deleted and reinstalled Anroid Studio. No effect.
The app doesn't change until a cold restart.
Is there any way to restore the previous behaviour?
Edit:
I have found the trigger of the problem but not yet the cause or a solution.
It seems to be a refactoring problem.
In an older version of the code, hot reload/restart works without problems. During development I moved a dart file to a new subdirectory. From /lib/app to /lib/app/home and let Android Studio adjust all references in the source code to this file. After that, the app can be compiled and started but hot reload/restart no longer works.
As a workaround, I have now copied the file instead of moving it and deleted the old file, but I would still like to know what exactly the problem is.
Have you tried running 'flutter clean' on your flutter project?
I assume you are not saving the changes made; try saving the changes (with cmd+s/crtl+s) then performing a hot restart or hot reload.

Android Virtual Device Not Detecting Code Changes After Hot Reload And Hot Restart - Flutter

I have been working on an app using flutter, everything was working fine until out of a sudden the android phone stopped detecting code changes when using hot reload and hot restart.
in order to make it detect these changes i have to stop the run phase and then run it again, like uninstall and install the app again, i tried invalidating the cache and restarting the android studio and tried flutter clean and i also tried wiping the virtual device's data, but nothing worked.
any help would be appreciated.

Deploy from Visual Studio to HoloLens Emulator without restarting the emulator?

Waiting for the HoloLens Emulator's OS to boot up every time I make some changes to my app and I recompile can be annoying. Is there a way to deploy a new build to an already running emulator?
Yes, just don't shut down the emulator. You can push the Stop button in Visual Studio, make your changes in Unity and rebuild. Your open project should detect the changes and ask you to reload the project. Hit the Play button in VS and your new code is redeployed to the emulator.

Flutter Hot Reload in Android Studio

I firstly wondered how to perform a hot reload in Flutter with Android Studio. Since I am already so used to the auto-save of Android Studio I did not even consider CTRL + S for the hot reload.
I then assigned the Flutter Hot Reload in the Keymap and this worked really well. But now I just realised that CTRL + S does also perform the hot reload. I looked the shortcut up in the Keymap and discovered that CTRL + S is mapped to Save All.
Now I am wondering what does Save All even do and does it do any extra compared to my assigned Flutter Hot Reload key combination?
I do not get the reason for Save All when Android Studio already saves everything automatically.
ctrl+s is to save and when "Perform hot reload on save" is enabled also "hot reload"
Conclusion
It really does matter. Apparrently the Flutter plugin simply reacts to a Save All call by executing Apply Changes, which will always call Flutter Hot Reload.
An interesting observation I made is that Flutter Hot Reload will not (as of writing) hot reload the application when there was no change in code, but Save All will and Apply Changes as well, which is why I wrote that Save All calls Apply Changes.
Write flutter run into the terminal present at below in android studio.
Once the app runs into your device or emulator press r into the terminal ->This will hot reload your app [for eg:- make some minor changes into your app after executing the flutter run then press r you can notice HOT RELOAD FUNCTIONALITY
In my scenario I was writing the code from scratch and not following the coding std.
Until then it was problem in Hot reload when I start working on
void main() => runApp(new HelloFlutterApp());

Resources