How to know on which flutter version a perticular project is made? - flutter

i have a flutter project and when i run it, it says to migrate to current version of flutter, but i don't want to migrate it, i can change my flutter version on which this project was made, so i can run it, i have tried to change my flutter version to 1.177, 1.22, 2.2 but it is still showing migrate error, so how to know if there any file available in project folder where we can see on which flutter version this perticular project is made, or is there other way to know it? please help.
If there is anything else you need, please tell me i will provide,
Thanks

in pubspec.lock file, you can check the version of every package including flutter in it.
also, It's optional to mention the flutter version in pubspec.yaml.

You can find the flutter and dart versions used in the project at the pubspec.lock file, at the very bottom.
Should be something like this:
sdks:
dart: ">=2.17.6 <3.0.0"
flutter: ">=3.0.0"

Related

How to use some flutter plugin as a dependency to a flutter package and use this package in my flutter app?

I am trying to make a single package for dealing with permissions and data flow for this I have used different plugins and packages as a dependency on this package. But some plugins throw errors of .
Does anyone know the reason behind it? It's working fine before flutter version 3.0. But not working now.
Try the following commands in the terminal;
flutter clean
flutter pub get
The issue is with flutter activity binding.
I solved it by doing these steps.
Go to your_app/android/app/src/main/AndroidManifest.xml
Search for activity tag.
Change android:name=".MainActivity" to android:name="io.flutter.embedding.android.FlutterActivity"
This will solve the issue.

How do I see previously installed versions of Flutter?

I updated flutter, and it screwed everything up. There's lots of info out there on how to downgrade, but I'm not sure what I need to downgrade to.
in your pubspec.yaml file, search for below line. your number might be different.
environment:
sdk: ">=2.16.0 <3.0.0"
the first number is your Dart version when you created your project if you didn't change it. for exp my dart version is 2.16.0.
Go to Flutter release notes page. go to announcement of every flutter version and see which flutter version use your Dart version.

How to downgrade flutter from version 2.5.3 to 1.22.6

I have some older projects built on flutter 1.22.6 and now I am working on latest version of flutter but there often comes need when I've to work on previous projects non null safety one's so when I try to downgrade flutter by giving command flutter downgrade 1.22.6 it tells me to downgrade to 2.5.2 and if I try to switch channel and then downgrade it downgrades to 2.5.2 first and then tells there is no version related to 1.22.6. This method used to be working before but now its not working anymore. I don't want to download zip files and then replace again flutter every-time I just want it to be done by cli.
My OS is windows 11
You can use flutter Version Manager fvm its specifically made to control flutter versions plus along with that you can install flutter sidekick as well. I am attaching link for you.
FVM Flutter Sidekick
Since you can no longer downgrade flutter versions, I have found the best way to do this is:
Download desired flutter version
Locate current 'flutter' folder and replace it with the desired version
if you run --flutter version after, it should show the correct version

VSCode, Flutter SDK Version Erroneous?

I believe my Flutter SDK version is being erroneously reported and do not know where the conflict is.
When running flutter doctor it reports Flutter 2.2.3 • channel stable. However, the bottom toolbar in VSCode displays Flutter: 2.0.4.
Is there a reason VSCode and terminal would report the Flutter version differently? And how can I ensure I am running the correct SDK version?
Look into "dart.flutterSdkPath" setting in vscode and change if needed. The problem could be with you having multiple versions of Flutter on the disk and auto-find fails to find the correct one (last version), manually override.
In my case my path( environment variables) of SDK was set wrong check yours first
and if still not worked try running commands
Flutter clean
Flutter upgrade

Flutter version used in project

Where can I see the flutter version used in a flutter project? Is there a file inside the project directory where I can see it? I think it is not specified inside the pubscpec.yaml file
So far, I think the specific version can not be found but only what versions can be used in a project. It can be found at the bottom part of pubscpec.lock file
pubspec.lock screenshot
It will not show version project wise. It will overall flutter version that you have installed in your system. For that:
Open your flutter project root directory in Command Prompt or Terminal type:
flutter --version command.
After typing the above command hit enter and You’ll see it will display us the currently installed flutter and Dart version in your computer and also tells us which version type we have installed like Stable or Beta.
Note: There is no such feature/command to check about which version of flutter you have used in Specific project.
Check this thread it will give you more idea:
https://github.com/flutter/flutter/issues/14230
All projects you run will use the flutter sdk installed in your machine/computer from where you specified its location from. So if the version the project uses don't match with the version you've and they conflict, you will have errors and if there is a huge gap and breaking changes, you'll need to either upgrade or downgrade the sdk. But most of the time, things are deprecated before they just become breaking changes and so you shouldn't have big issues. So the best thing to do is usually to upgrade. First check your sdk version via flutter --version. If its outdated, use flutter upgrade to upgrade it.
You can either run flutter --version to check flutter version installed on your machine or check it in your pubspec.lock file for current flutter version in your project
sdks:
dart: ">=2.10.0-110 <2.11.0"
flutter: ">=1.16.0 <2.0.0"