How to update version in Flutter? - flutter

I have an app that has been put on the market, I want every time I change the version, the app will give an update reminder to the user.
Exam: I'm on version 2.0.0 + 99 but the market (CH Play,App store) is version 2.0.0 + 100, is there a way for the app to give an update for this case?
I have tried Upgrader Package and new_version package but it doesn't work because it checks local version is 2.0.0 and there is no change. I want to check +100 (2.0.0+100) what should I do?

Write in the vscode terminal the following code:
flutter upgrade
And want to know more commands related to flutter write:
flutter --help

Related

Problem updating to a specific version of Flutter

I have an old version of flutter.
I would like to update the version but not to the latest. I tried the command
flutter upgrade
and then
flutter downgrade 3.3.1
but it only returns me to the version I had previously and not to an intermediate version between my old one and the latest version available.
What can I do?
Thank you.
To downgrade to a specific version of Flutter, you can use the following command:
flutter upgrade --force-downgrade -v enter your version here
Replace with the version number you want to downgrade to (e.g., 3.1.1). The --force-downgrade option is necessary as it allows you to downgrade to a previous version of Flutter.

How to update specific flutter SDK channel?

Currently, i m using flutter 3.3.9 i want to update it to 3.7.3
Any particuler command?
Note : I don't want to affect my current code
Need perment solution for it.
Change channel if you are not in correct channel otherwise go to step 4
Open a terminal or command prompt on your computer.
Check the available Flutter channels by running the command flutter channel.
This will show you the list of available channels and the current channel you are on.
Switch to the desired channel by running the command flutter channel <channel-name>.
For example, to switch to the stable channel, you can run flutter channel stable.
Choose the version.
This is possible now with flutter version. In the console do flutter version to list the versions available. Then choose a version to switch to: flutter version v3.7.3
For these cases, try to use FVM (Flutter Version Management).
fvm install 3.7.3
fvm use 3.7.3
For get more detail here its official website https://fvm.app/
The advantages is you can any cases you can simply go back to your previous flutter version. And also you can work different flutter project with different version

How to specify local Flutter version (e.g. an older release)?

I would like to test my application / package running on an older version of Flutter, e.g. specifically Flutter v2.2.3.
There are 2 commands, flutter upgrade and flutter downgrade which might seem to be relevant, but how do I select the specific version of Flutter I want to use? flutter upgrade --help and flutter downgrade --help do not provide any extra information.
Recommended (git): Just checking out a specific commit in the Flutter repo
Change directory to your flutter installation folder, e.g. /opt/flutter.
git checkout the git tag (change to the branch pointed by the tag). For example, there is a git tag called 2.5.0 for the version 2.5.0, so run git checkout 2.5.0. (Thanks Eugene :) )
Or alternatively, if I want version 2.5.0, I can get the commit SHA (ref) from the Flutter SDK releases page. That website says the ref for 2.5.0 is 4cc385b. At the flutter installation directory, run git checkout 4cc385b.
Then in the terminal, run flutter (or any specific flutter command) to download and build this version of flutter.
Using FVM (Flutter version Management)
You also specify the specific version of Flutter using FVM, e.g. fvm use 2.5.1
Download the specific version of Flutter from Flutter SDK releases and install it.
This is the slowest way, as you would have to download the entire repo again.
Just download that specific flutter version from here. and just set the flutter version in your editor and try to run it will run that specific flutter version but make sure you can't run that with terminal commands. So you need to handle all commands from the Tools option.
set flutter version
Must Run commands from here

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

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"