What is the problem while saving flutter code - flutter

Good evening everyone I have a problem if I modify the code on android studio the changes do not appear on my emulator unless I restart android studio

You need to "deliver" your code to a device. From Android Studio, you can click on Flutter Hot Reload (Flash icon on screenshot), or do this action by shortcut (depends on OS on your computer, put mouse cursor to Flutter Hot Reload icon and IDE give hint about hot key for this action): Ctrl + Shift + \ on Windows or Shift + \ on macOS.

Related

On start debugging a new browser window pops up in flutter using vscode

I'm trying to hot reload my flutter app that runs on a browser but whenever i run ctrl + f5 or f5 a new blank browser window appears.
Can someone help please
may be you can try flutter run -d chrome to Run Chrome using the default renderer option

Get Dart Devtools to open in Chrome

Currently, Dart Devtools opens as a tab in VSCode. I want it to go back to opening in Chrome as it did in previous versions of Flutter.
Update VSCode to the newest Version.
VSCode Update
Update Flutter
flutter Update
Now run your Project and then click [ctrl] + [alt] + [d] for running dart devtools. VSCode is asking you where you wish to open DevTools.
Do not bother about it mate, just add this line on settings.json
"dart.embedDevTools": false
Then you will get again DevTools on Chrome. Just shortcode: Ctrl + Alt + D.
That's it.
In your terminal, run:
dart devtools
It will open Flutter Devtools page in your default browser. When you start an application is should print an id starting and ending with ws. This id will be used to connect devtools to the app
"dart.embedDevTools": false
is not relevant anymore, instead you should use:
"dart.devToolsLocation": "external"

What is the difference between hot reload, hot restart, and full restart?

What is the difference between hot reload, hot restart, and full restart in Flutter and does web support them too?
Hot Reload:
Hot reload loads code changes into the VM and re-builds the widget tree, preserving the app state; it doesn’t rerun main() or initState().
For IntelliJ or Android Studio: cmd + \
For VSCode: ctrl + F5
Hot Restart:
Hot restart loads code changes into the VM, and restarts the Flutter app, losing the app state.
For IntelliJ or Android Studio: shift + cmd + \
For VSCode: shift + ctrl + F5
Full Restart:
Full restart restarts the iOS, Android, or web app. This takes longer because it also recompiles the Java / Kotlin / ObjC / Swift code. On the web, it also restarts the Dart Development Compiler. There is no specific keyboard shortcut for this; you need to stop and start the run configuration.
Flutter web currently supports hot restart but not hot reload.

Can not change or remove logs from project

I'm facing a weird issue. I inserted some logs just like below:
log('whatever messager you want');
Now, no matter if I comment them or change the message inside them, nothing changes. Thay remain there the way I set it the first time. It happens in both VSCode and Android Studio.
I already tried:
deleting and installing the app again.
reload vscode window
close and reopen vscode
restart windows
Nothing worked for me.
Have you tried to run
flutter clean
in your project directory?
In my case, Ctrl + Shift + B was displaying No build task to run found and ctrl + F5 wasn't updating my code changes when using VSCode.
The solution I found was to migrate to Android Studio. I relaunched the emulator from Android Studio and the Run button updates the app correctly.

Hot Restart (previously Full restart) in Flutter VS Code whilst debugging

Whilst running my app using flutter run in the console I can press 'r' to do a reload and press 'R' to do a reload and restart. Is there a way to do this whilst debugging in VS Code? Saving a file causes a hot reload but I can't figure out a way to do a full restart.
Edit
This is a little bit different to the hot reload option so I don't think this is a duplicate. This question regards performing a full restart of the application without reinstalling it. This is possible by pressing a capital R in the console, as opposed to pressing a lowercase r in the console which would perform a hot reload.
When debugging you can press Ctrl+F5 for a full restart, or you can run the Flutter: Full Restart command from the VS Code's command palette (Ctrl+Shift+P or Cmd+Shift+P for macOS).
Note: In the next version (v2.13.0, which there's a beta of available) "Full Restart" has been renamed to "Hot Restart" to better reflect how it works (this is happening across the other Flutter tools and docs too).
Related info:
Flutter VS Code docs
Dart Code keybindings
Dart Code debugging commands
The chosen answer wasn't working for me with Flutter 1.2.1 so I used this solution:
get the Flutter extension
search for dart.flutterDebuggerRestartBehaviour in VS Code settings and set it to hotRestart
start the debugger (F5) and click the restart button when you want to hot restart: