How to check the installed version of Flutter? - dart

How do I find the version of Flutter I have installed on my computer?

use the following command
flutter --version

Flutter
Version:
flutter --version
SDK location:
where flutter
Detailed information:
flutter doctor -v
Upgrade
flutter upgrade
Change channel to, say beta
flutter channel beta
flutter upgrade
Dart
Version:
dart --version
SDK location:
where dart

As others have said use
flutter doctor
or
flutter --version
If that is not working you need to make sure that the flutter/bin directory is in your path:
echo $PATH
If it isn't see this link to add it.

Flutter
Open the terminal, simply write
flutter --version
To see full overview and related other necessary things
flutter doctor
To see the installation path
echo $PATH
Dart
To see the dart language version
dart --version

Simply navigate to flutter sdk folder and open the file version
flutter/version

If you want to check your flutter version:
flutter --version
If you want to upgrade the flutter version:
flutter upgrade

To know your Flutter SDK version, execute the command below:
flutter --version
SDK location:
where flutter
Detailed information:
flutter doctor -v

Related

Class AMSupportURLConnectionDelegate is implemented in both

I'm trying to build a flutter app on M1 mac and getting the following error.
$ flutter build ios --release
Building XXX for device (ios-release)...
Automatically signing iOS for device deployment using specified development team in Xcode project: XXX
Running pod install... 13.2s
Running Xcode build...
Xcode build done. 6.7s
Failed to build iOS app
Error output from Xcode build:
↳
objc[65074]: Class AMSupportURLConnectionDelegate is implemented in both ?? (0x1f66de518) and ?? (0x1160d82b8). One
of the two will be used. Which one is undefined.
objc[65074]: Class AMSupportURLSession is implemented in both ?? (0x1f66de568) and ?? (0x1160d8308). One of the two
will be used. Which one is undefined.
** BUILD FAILED **
Xcode's output:
↳
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: The linked framework 'Pods_Runner.framework' is missing one or more architectures required by this target:
armv7. (in target 'Runner' from project 'Runner')
Encountered error while building for device.
Here is my flutter doctor -v
flutter doctor -v
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0 20A2411 darwin-arm, locale en-AU)
• Flutter version 1.22.4 at /Users/mlee/development/flutter
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Users/mlee/Library/Android/sdk
• Platform android-30, build-tools 30.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 12.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.2, Build version 12B45b
• CocoaPods version 1.10.0
[!] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.51.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.16.0
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
try a simple, documented step first
In Terminal:
sudo xcode-select -r
explanation
The command resets xcode to the default path (see documentation excerpt below). This command
resolved the issue for me and
avoided the risk of introducing random, undocumented ideas from strangers.
These advantages make it worth trying first, especially since documented approaches typically won't interfere with future version upgrades. Experimental workarounds may need to be undone first.
documentation
% xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
[...]
-r, --reset reset to the default command line tools path
I had the same issue. I saw the same error when I ran flutter build ios.
The error message was displayed red color on my VS code terminal, but it was kind of misleading. I found it was not the main issue.
The actual issue should be on the following error section.
So, please run flutter build ios --verbose and read the output carefully.
In my situation, there were other issues of the failure of flutter build ios. The issues were like forget to put in GoogleService-Info.plist or iOS target version is less than the requirement of flutter packages.
installing ffi helped me. I was stucked from last two days and then I finally found this solution.
arch -x86_64 sudo gem install ffi
use this if you are using m1
sudo gem install ffi
if you are intel Macs
Thanks Hope this will work.
Got the same error, also on an M1 macbook. Fixed it by:
flutter clean inside the project directory.
flutter build ios
'Start debugging' (vs code).
Somehow I managed to fix the issue by removing the flutter/bin/cache folder.
This could be a combination of other random things I did to solve this issue.
Things I've tried.
Running the terminal using Rosetta.
Upgrade dependency versions as well as running flutter pub upgrade
Remove ios/Pods & Podfile.lock
Reorganise xcconfig files - make sure to include Generated.xcconfig
I've created base.xcconfig and configure it with the existing Pods-Runner.release.xcconfig
This is my base.xcconfig
#include "Generated.xcconfig"
#include "Env-defaults.xcconfig"
#include "Env.xcconfig"
I was running into the same error using the M1 chip on my mac. I created a new project and realized that the new projects build settings exclude
Any IOS Simulator SDK: arm64 i386
under 'Excluded Architectures'
I replaced all /app/ios files with new from fresh application created by flutter create
FINALLY got it working -- here's what I had to do starting from the project root:
cd ios
rm -rf ~/Library/Caches/CocoaPods
rm -rf Podfile.lock
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
Then:
pod deintegrate
pod setup
pod install
For anyone running into this issue on M1 run the iTerm/Terminal from Rosetta. Follow the below commands.
Installation of Rosetta,
softwareupdate --install-rosetta
Running from Rosetta,
Goto applications folder.
Right click on iTerm >> Get Info.
Check open using Rosetta.
Thats it open the terminal, the issue will be fixed.
Got the same issue on Macbook M1.
Changed the iOS Deployment Target of the project Runner to 10.0.
Fixed the issue.
Normally it is working after these steps
flutter clean
flutter pub get
cd ios
pod install
cd ..
flutter build ios
This time it worked for me with an additional command flutter upgrade pub as I was using the newer version of flutter with old pub file. I hope it may help someone using M1 processor.
My Solution for this problem was:
Delete /flutter/iOS/Podfile & /flutter/iOS/Pods & flutter/iOS/Podfile.lock
flutter clean
Enjoy :)
I solved this problem!
rebuild new flutter project
open terminal
move to ios directory (project)
pod init
pod install
modify ios/Podfile file as this content
link : https://github.com/t-sakurai816/flutter_todo_new/blob/main/ios/Podfile
I tried pretty much everything yet nothing worked for me.
Except this -
Open your podfile and do the following
change
use_frameworks!
to
use_frameworks! :linkage => :static
I kept running into a similar problem from React Native too on M1 and I am leaving this here if anyone might need it.
What worked for me is having to run the project from inbuilt terminal with Rosetta enabled. All the project related config, npm install and pod installs had to happen on inbuilt terminal for the error to go away
npm install
cd ios && pod install && cd ..
npm run ios
If you have installed cocoapods using gem as well as home-brew also then please remove gem installed cocoapods.
On my Mac mini m1 cocoapods installed using "gem" was not working so installed from home-brew. Because of that system was having both versions. I got this same problem for every flutter command run because of this.
After removing "sudo gem uninstall cocoapods" this error disappeared.
Open ios/Runner.xcworkspace in xCode and try to run it on your iPhone and the error should tell you your issue.
In my case, I had to login with my apple ID in Xcode and download certificates.
This was quite a journey for me to fix. I tried many things and I'm not exactly sure which one fixed it but here's what I did
First off try building the app for Android instead of iOS. This will tell you if the error is specific to iOS or if it's something else. After building for android I had the error "member not found package root". To fix this I did
flutter pub upgrade
I use Apple silicon, I ran this command
sudo gem install ffi
Along my journey of fixing this I realized I use the system ruby when I should be using homebrew installed ruby
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc
uninstall all cocoapods from gem
gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
install cococapods from brew
brew install cocoapods
then try and rebuild your project
Delete the line
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
in ios/flutter/Debug.xcconfig
Works for me
I've fixed the issue by doing this:
cd ios
pod init
pod install
hope it will work for you also
It seems this error may occur due to various reasons and this 'Error output from Xcode build:' does not reflect the actual error.
I was able to fix this issue by opening ios/Runner.xcworkspace using Xcode and selecting the correct team in 'Signing & Capabilities'. Then I was able to run flutter run without getting this error
If you see an additional error that states: error: no such module 'Flutterz', go into your AppDelegate.swift file and change import Flutterz to import Flutter.
After fixing above, I no longer received the AMSupportURLConnectionDelegate is implemented in both error message.
I ran into the problem 2 times and it had 2 times separate root causes.
First cause was that one of the libraries I used got outdated - after upgrading from 1.x to 2.x. It was NOT visible on the pub.dev page that this plugin got outdated, only on the respective Github page. It was some Google library. Once the plugin got commented out, it worked.
The second case was way harder to find. It happened after upgrading to 2.2.0 and some of my images were suddenly not working anymore. I needed to comment them out, then the error went away. No clue why these PNGs suddenly not work anymore, but it is reproduce-able. Every time you find an image that doesn't work, run flutter clean afterwards followed by pub get and only THEN start again a build on the simulator.
Hope this helps someone, it cost me more than 5 days...
For the people using M1 chips:
In Xcode, target Runner, Go to Build Settings
Check Architecture and select standard if arm architecture is selected.
I had the same problem.
I fixed the problem:
Rename the ios folder to ios.old
I have created a new flutter project and copied the ios folder to my project
I have copied the info.plist file from the ios.old folder to the new ios folder
I think it would only be necessary to copy the images of the icons.
In my case, the problem was caused by an invalid release version number, it should contain only digits, no strings
Try Selecting For install builds only in the run script in the Build phases tab.
I changed
Another fix could be
flutter clean
rm -rf ios/Flutter/Flutter.framework
cd ios
pod install
Thanks to https://github.com/CocoaPods/CocoaPods/issues/7234#issuecomment-606591037
In my case the solotion was to comment this line of podfile:
# platform :ios, '14.3'
It has happened to me a few times. Almost always it was related to a mistyped name of an asset or pointing to a wrong asset package.

update dart sdk for flutter

I would like to use dart SDK >= 2.2.0 with flutter. But my current version used BY Flutter is 2.1.2
flutter --version
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (2 months ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
I tried to install the 2.2.0 version independently and I succeed :
dart --version
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"
However, Flutter doesn't use this version as you can see above. I tried to replace files of the dart-sdk used by flutter (flutter/bin/cache/dart-sdk) by the version that I installed independently, but when I try to run Flutter after that I have a snapshot problem so I have put back the original dart-sdk folder in the flutter directory.
Do you have any ideas how can I update it?
PS: I downloaded flutter very recently (10 days ago) from here: https://flutter.dev/docs/get-started/install/macos
It might be due to the fact you are on channel stable which is the most secure builds of the four channels to get updated (channels are listed here)
If you are a bit more curious to try out the new features without having to risk bad builds I advocate channel beta:
Every month, we pick the "best" dev build of the previous month or so, and promote it to beta. These builds have been tested with our codelabs.
where the stable channel has this description:
When we believe we have a particularly good build, we promote it to the stable channel. We intend to do this more or less every quarter, but this may vary. We recommend that you use this channel for all production app releases. We may ship hotfixes to the stable channel for high-priority bugs, although our intent is to do this rarely.
You can change the channel to point at beta by running this command in your terminal:
flutter channel beta followed by flutter upgrade to ensure you have got the last release for this particular branch.
Let me know how this affect your situation.
You have to upgrade flutter from cli with flutter upgrade command. Then flutter will use latest version of Dart SDK. Flutter does not use your local Dart Sdk.
This issue is because of the dart version and by updating flutter the dart version won't update,
the way for solving this is,
first, you need to be on the dev or master channel,
flutter channel master
flutter upgrade
after that run flutter doctor -v as you see your dart is still an old one
in this step, you should update it manually, as the doc says Dart
for Windows user
choco upgrade dart-sdk
for Mac users
if you user brew to install dart
brew upgrade dart
and if you don't, you can install it
brew tap dart-lang/dart
brew install dart
wish this solves your issue.
You might need to Update your pubspec.yaml depending on the flutter channel you want to work on:
If you are on stable channel :
Go into pubspec.yaml and type in:
environment:
sdk: ">=2.2.0 <3.0.0"
(Whatever Dart SDK version you want comes in the front)
dependencies:
cupertino_icons: ^1.0.0
If you are on beta channel :
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
cupertino_icons: ^1.0.1
Then if you are on stable channel (or beta), open the terminal in your IDE and enter
flutter channel stable
# or flutter channel beta
flutter upgrade
flutter pub get
Check the version with flutter --version
Hope it helps.
follow some command given below :
1.flutter version -> give all the flutter version list available.
2.flutter version v1.12.13+hotfix.7 -> you can switch to any given flutter version
in your console by 1st command.
Open terminal commands to Upgrade Flutter – Dart SDK
1-> C:\flutter
2->run command " flutter channel master "
3->run command after switching " flutter upgrade "
Now open android studio which automatically fetch updated sdk from flutter folder
You can upgrade dart SDK using terminal by typing flutter upgrade.
This will upgrade both flutter and dart SDK.
Actually flutter upgrade includes the Flutter and Dart SDK and doesn't install them separately.
if you using android studio,
Tools->Flutter->Flutter upgrade
click on flutter upgrade then you can install it
Try this
flutter channel stable
flutter upgrade
or this
flutter channel master
flutter upgrade
it is so simple if dart was installed with flutter just do the below line:
flutter upgrade
If using windows, you can use chocolatey to upgrade sdk by using command.
choco upgrade dart-sdk
If you want the latest pre-release version:
choco upgrade dart-sdk --pre
Yeah, the cause of the problem is inherent in the fact that Flutter does not use the dart present on your Local machine the Flutter sdk instead comes with the
latest compatible dart sdk shipped along with it.
When you run the command flutter version it prints the current flutter version and the current dart-sdk version shipped along with it. If you wish to use a later version of the dart sdk you'll have to upgrade your flutter sdk and if the specific dart-sdk version you want is not yet available for any branch in the stable channel I will suggest you switch to the master or dev channel and hopefully the latest release of those channels will support the required sdk constraint you need. But beware other branches aside the stable branch are not totally safe as you can encounter strange and unresolved errors so have that at the back of your mind.
I'm using flutter upgrade channel stable on macOS and it's working fine
The dark SDK that you updated is probably the one on your global dart installation.
Check your flutter dart path with the command
which flutter dart
If it is looking like this
[/path-to-flutter-sdk]/bin/flutter
/usr/local/bin/dart
you need to change it to use the one associated to flutter:
[/path-to-flutter-sdk]/bin/flutter
[/path-to-flutter-sdk]/bin/dart
To update it, you need to update your $PATH so [/path-to-flutter-sdk]/bin/flutter comes before /usr/local/bin.
I have two version of flutter SDK at the same time for two different flutter projects. I had changed the current SDK to 1.12 so it was complaining about dart SDK version. I changed the current version to 1.20 and the problem solved.
If you struggle to make any of these solutions work, you might have different versions of flutter on your system.
I checked my version on the command line and upgraded via 'flutter upgrade' to the latest stable release, which did not solve the problem in IntelliJ / Android Studio, as that pointed to another local version of flutter.
To check, run 'which flutter' on the command line and check with the version displayed in "Preferences --> Languages & Frameworks --> Flutter" and make sure they point at the same flutter installation.

Dart version is 2.2.0 but I get an error requiring version >=2.2.0

I have the latest version of Flutter and I'm trying to run the official Flutter gallery app. When I do dart --version I get
Dart VM version: 2.2.0 (Tue Feb 26 15:04:32 2019 +0100) on "macos_x64"
However, when I try to get the packages:
[flutter_gallery] flutter packages get
Running "flutter packages get" in flutter_gallery...
The current Dart SDK version is 2.1.2-dev.0.0.flutter-0a7dcf17eb.
Because flutter_gallery requires SDK version >=2.2.0 <3.0.0, version solving failed.
pub get failed (1)
exit code 1
What's interesting is when I run flutter upgrade it lists an older version of Dart (Tools).
Upgrading Flutter from /Users/leejohnson/dev/flutter...
From https://github.com/flutter/flutter
a1bee54fd..59ce7d6bf dev -> origin/dev
55a2ee588..f8f2b043e master -> origin/master
* [new tag] v1.3.13 -> v1.3.13
Already up to date.
Upgrading engine...
Already up-to-date.
Flutter 1.2.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 8661d8aecd (5 weeks ago) • 2019-02-14 19:19:53 -0800
Engine • revision 3757390fa4
Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
If I understand this error correctly, Flutter is not using the latest version of Dart yet the official Flutter example app requires it. How do I fix this?
The output of dart --version is completely irrelevant for Flutter. What you need to check is flutter doctor -v or flutter --version. In your case it shows Tools • Dart 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
You probably need to switch to another channel until the next stable channel update
flutter channel dev
or
flutter channel master
Flutter has its own dart-sdk in flutter/bin/cache/. So when you do dart --version , its probably another dart sdk in your system.
For anyone else stuck (The other channels were broken), what I found was switching to stable then switching versions within stable fixed it for me. You can do this by doing the following:
flutter versions
flutter versions 1.5.5 (Or some other version)

Flutter and Dart Plugins Android Studios

[✗] Android toolchain - develop for Android devices
✗ ANDROID_HOME = User/grantrienstra/Library/Android/sdk
but Android SDK not found at this location.
Is what I've been getting when I run flutter doctor -v and Youtube has not yielded any answers. Do you know how to install the Android toolchain? I have Android Studios downloaded and the Flutter and Dart plugins integrated.
By checking your path I'm assuming you're on Mac so try to add the tools and platform-tools to your PATH environment variable by running the following on the terminal:
export PATH=$PATH:~/Library/Android/sdk/tools
export PATH=$PATH:~/Library/Android/sdk/platform-tools
Then you should be good to go.

flutter packages get failed depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed

I create a flutter project, and run flutter packeages get,the output as below:
[second] flutter packages get
Waiting for another flutter command to release the startup lock...
Running "flutter packages get" in second...
The current Dart SDK version is 2.0.0-dev.63.0.flutter-4c9689c1d2.
Because second depends on flutter_test any from sdk which requires SDK version <2.0.0, version solving failed.
pub get failed (1)
exit code 1
flutter doctor -v
PS D:\dartstudy\second> flutter doctor -v
[√] Flutter (Channel dev, v0.5.7, on Microsoft Windows [Version 6.1.7601], locale zh-CN)
• Flutter version 0.5.7 at E:\flutter
• Framework revision 66091f9696 (2 weeks ago), 2018-07-09 12:52:41 -0700
• Engine revision 6fe748490d
• Dart version 2.0.0-dev.63.0.flutter-4c9689c1d2
[√] Android toolchain - develop for Android devices (Android SDK 28.0.1)
• Android SDK at f:\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.1
• ANDROID_HOME = f:\Android\Sdk
• Java binary at: E:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
• All Android licenses accepted.
[√] Android Studio (version 3.1)
• Android Studio at E:\Program Files\Android\Android Studio
• Flutter plugin version 26.0.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code, 64-bit edition (version 1.25.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.16.0
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
the IDE that I use to create a project is VS code.
I changed some versions of flutter sdk, the problems are the same as above,How to fix this problem?
I was having a similar issue:
Running "flutter packages get" in austin-feeds-me-flutter...
The current Dart SDK version is 2.0.0-dev.58.0.flutter-f981f09760.
Because austin_feeds_me depends on palette_generator any which requires SDK version >=2.0.0-dev.61.0 <3.0.0, version solving failed.
pub get failed (1)
Process finished with exit code 1
I fixed it with the following commands:
flutter channel dev
flutter upgrade
Fix source: https://github.com/flutter/flutter/issues/19382
just update your sdk by these codes
flutter channel dev
flutter upgrade
if you live in iran you need to use proxy because google no let you to use its packages
and for scoped_model you need to use below version of it in your pubspec.yaml file
dependencies:
scoped_model: ^1.0.1
and then save the file, your IDE automatically update the package
I solved my error by using any instead of the version codes like this
flutter_test: any
instead of
flutter_test: ^1.1.0+1
Just modify the package version in pubspec.yaml to the latest version fixed my issue.
I know this is an outdated question but I think someone will benefit from this and also the answer is relevant not outdated.
You need to fix environment: in pubspec.yaml to allow the Dart SDK version you are using (the one from Flutter)
environment:
sdk: ">=2.0.0-dev.68.0 <3.0.0"
The essential part is <3.0.0
Originally answered here in GitHub by someone called Günter Zöchbauer:- https://github.com/flutter/flutter/issues/21421#issuecomment-418718539
Just upgrade flutter to the latest version. This solved the problem for me.
flutter upgrade //for upgrading flutter enter this in CLI.
I found the solution of this question by myself.I add the system environment variable PUB_ALLOW_PRERELEASE_SDK=false,so Just remove this system environment variable, the question will be solved.
I have the same issue and flutter upgrade --force fixed the problem.
Note: re-run the command flutter pub get after upgrading your flutter version.
So here are some options to consider in solving this issue:
If you have tried the above solutions and it didn't work, then
You probably have issues with your flutter SDK and need to fix that first. You have changes in your flutter SDK.
To fix this, kindly cd into your flutter directory. For instance D:\repo\flutter
Find out what git changes you have in this directory using git status
Use git add * to add these changes (files) and then do git stash
To ensure that you're on the latest build from this channel, run flutter upgrade
You should be able to switch to any of your flutter channels
Stay safe. All the best
Maybe your Flutter SDK is not in the latest version. upgrade it by below command (and the documentation says, it is preferred to keep stable channel, upgrade to dev only if it essential)
flutter upgrade
I have resolved this by adding integration_test above test declaration, I saw this solution in official codelabs: https://codelabs.developers.google.com/codelabs/flutter-app-testing#2
As on pic:
I think this is a better way, than downgrading the plugin by using 'any' or changing flutter channel.
Inspect correctly your "pubspect.yaml" it's possible

Resources