Switch between Flutter web and flutter mobile development in VS Code - flutter

So I have 2 different projects in my visual studio code, for flutter web development and mobile development ...
I see the tutorial if want to make flutter web must switch "flutter channel master", but when I switch it to master my mobile project got an error.
So my problem is every time I want to switch projects between I must change channels to master for web and stable for mobile?
is there any way to do it without switching channels? thanks sir!

That tutorial is old (in Flutter terms).
Flutter is in active development and rapidly growing. Features that where experimental and then beta become releases in the stable branch quite fast if you are used to other languages and frameworks.
Development for the web has been in the Stable branch for about a year now.
You can just use stable for both mobile and web applications.

Related

Generate HarmonyOS (Huawei) build from Flutter project

I am working on one Flutter project. In which, We want to generate builds of Android, iOS, and HarmonyOS (Huawei). But I am not sure does Flutter supports this OS or not. I went through some of the stuff on the internet but was unable to figure out how to generate and what kind of commands were needed. Here, Anyone has previously generated HarmonyOS compatible build from the Flutter project. Please share your thoughts.
For now it is not possible directly from Flutter. Because of the change in architecture brought by Huawei with HarmonyOS it is not anymore an "Android device" and it doesn't run "Android applications".
Now what you can call "native HarmonyOS applications" are *.app files (not *.apk or *.aab)
Most recent answer on Quora to:
Will Harmony OS run Android apps?
Gives the following response:
Answered Jun 4, 2021 by Mahdi Parastech, Software Engineer
Nope, because:
The structure of the APIs are different.
Hongmeng (HarmonyOS) apps are in *.app, Android apps are *.apk
The structure of pages (activities) are different, Hongmeng uses some additional json files and puts pages inside *.har files.
Hongmeng uses Javascript too, and that's the only option in Wearable Hongmeng devices, but Android apps are just written in Java.
source
Apparently you should be able to migrate your native android application to HarmonyOS by using their IDE but the thing is that Flutter was not build for this architecture.
Except if the Flutter team decides for some reason to support HarmonyOS I don't think it will be possible to develop HarmonyOS applications by using Flutter.

Android Studio: should I upgrade to Android embedding v2?

I am actively learning dart/flutter, and using Android Studio. Just practicing to learn as much dart as possible. For now, I manly test my code by outputting into console. When I run the code, I get the warning message below (about upgrading to Android embedding v2), see picture. For now, I am not interested in developing apps for Android nor IOS, I am focusing mainly on web apps.
Is the warning below something I should consider upgrading now to Android embedding v2? Or can it wait until I decide to start testing Android apps?
The main reason why I didn't upgrade, it's because I read the Android embedding v2 upgrade instructions, and it requires to edit some files, and I don't want to risk messing up Android Studio, nor Dart, nor Flutter files. Also, this is the first time I use this IDE.
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It's being deprecated in favor of Android embedding v2. Follow the
steps at
https://flutter.dev/go/android-project-migration
to migrate your project.

How to use both Flutter stable and dev SDK on the same machine?

I'm working with Flutter to make a Mobile App using the stable Flutter SDK release. But I also want to try Flutter Desktop and Flutter Web that are not part of the Flutter stable channel yet, but are present on the Flutter dev channel.
My question is... How can I try Flutter Desktop and Flutter Web without override the Flutter stable release on my machine?
You'll need to setup alias to switch between different environments easily.
See here a detailed article for that.
I found this Dart package called Flutter Version Management that does exactly what I want.
As the docs says:
Flutter Version Management: A simple cli to manage Flutter SDK versions.
Features:
Configure and use Flutter SDK version per project
Ability to install and cache multiple Flutter SDK Versions
Fast switch between Flutter channels & versions
Dynamic SDK paths for IDE debugging support.
Version FVM config with a project for consistency across teams and CI environments.
Set global Flutter version across projects
https://github.com/leoafarias/fvm
Now I just need to add FVM_HOME/default/bin to the PATH and FVM will take care of everything...
Two solutions
Put the installation files in two different directories one with stable and the other dev and add one of them to the path then you can change the path variable when needed to use the other channel.
Put the flutter repository file in two different directories one with stable and the other with dev then,
add the first installation to the path then add an alias to point to the second installation directory.

SDK prevents `Hot Reload` & `Hot Restart` from working

When using the Here SDK for Flutter Hot Reload & Hot Restart stop working. I can tell this because when I switch to another branch which doesn't use the HERE SDK these two features work as supposed.
Within the HERE SDK integration branch these tasks will run endlessly. This makes the SDK practically unusable as recompiling takes too long for a smooth developer experience.
I can force a Hot Restart by moving the HERE map with my fingers. Something within the SDK is preventing this essential Flutter feature from working. Is there something I've overseen?
My SDK version is "HERE SDK for Flutter (explore Edition) - Version 4.3.2.0"

Flutter Without Emulator

I cannot install the Android Emulator in my working environment, therefore I wondered whether it is possible to code/learn Flutter without any mobile device (or emulator). For example, is it possible to run/test the code by using the browser?
There are two non-mobile options, both of which are currently in development stages but could be used for learning Flutter:
flutter-desktop-embedding, particularly the example which you can check out and flutter run with minimal setup, and then modify.
The Flutter for web technical preview.
Flutter Desktop Launcher for Mac OS/Linux, support hot reload via VS Code
GitHub Link: https://github.com/putraxor/flutter_desktop_launcher