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.
Related
I want to get started with flutter web so I am trying to install dart-sdk for windows (stable version Link: https://gekorm.com/dart-windows/) but it doesn't download.it always show a message,download failed:The operation timed out.
actually you don't need to install dart SDK separately, because flutter SDK comes with dart SDK together in one zip.
to start flutter web app you need to change flutter channel to beta and enable web configuration :
flutter channel beta
flutter upgrade
flutter config --enable-web
or I recommend downloading the flutter beta SDK from here:
and use separately it from your stable SDK
you can find more info about flutter web here
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)
According to Google, Flutter Preview release 1 is available:
Preview Release 1 post on medium
I startete a project using BETA 0.5.1.
If I upgrade flutter from within Android Studio, it stays at release 0.5.1:
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale de-DE)
Is 0.5.1 actually Flutter Preview 1?
Should I upgrade my project? How and why?
To get the latest version in your channel, you can always run flutter upgrade.
If you want to switch to a more recent (and more unstable) channel, you can run flutter channel dev or flutter channel master.
Running flutter channel will show you all available channels:
beta
dev
master
If you're looking for a 1.0.0-pre release, then no. There are none.
The current flutter version out of 25 august is 0.7.1-pre.26 on master channel
You can run flutter upgrade to move to higher versions.
You can also use flutter channel master to switch on master branch
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
I installed Flutter following official document and also installed Flutter and Dart plugin on Android Studio.
But, I can't see File>New Flutter Project wizard on Android Studio 3.0.1
I run "flutter doctor" command. See the below output.
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.1.5, on Mac OS X 10.13.3 17D102, locale en-TR)
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 9.2)
[✓] Android Studio (version 3.0)
[✓] IntelliJ IDEA Community Edition (version 2017.3.3)
[!] Connected devices
! No devices available
! Doctor found issues in 1 category.
You need check the “AndroidAPK Support” in your Plugins.
See this screenshot:
If you are sure to have both Dart and Flutter plugins correctly installed, check again your Plugins and be sure that Android APK Support is enabled.
If it isn't, enable it!
Et voilà! Now everything should be fine:
You can find the plugin menu inside the Welcome page
or, when you have a project opened, inside the Preferences menu:
Had the same problem. Check-in Android Studio if the Dart and Flutter plugins are both installed and marked with a lock symbol in Preferences --> Plugins.
Anyway, the following procedure helped me:
uninstall the Flutter plugin
restart Android Studio.
uninstall the Dart plugin
restart Android Studio again which seemed important to do
install the Dart plugin again
restart Android Studio although it is annoying
install the Flutter plugin again
and guess: restart Android Studio
After the last restart I saw the success message:
I assume we both installed both plugins without restarting after Dart.
I also faced it but soon I solved it
I simply install flutter and dart plugins and restarted Android Studio.
After restarting I noticed that there is no Wizard for creating flutter apps. But soon I realized that I have disabled some plugins ( Android Studio's default plugins ) so I enabled all plugins and restarted Android Studio again and BOOM! Now there is a wizard for Creating Flutter Apps.
Hope this helps you !
My answer will be nearly same with #VickyBOSS but I'll upload screenshots of before and after ;)
First and foremost Flutter and Dart plugins must be installed before.
After installing these plugins you can check if it is ok or not with flutter doctor
If you hadn't installed the plugins you would have this:
Android Studio
At first, I didn't see "Start a new Flutter project"
After:
I have also same problem.but what can you do in that situation is Just create the project with command line :
flutter create your_app_name
Now open android studio and open that project. Hope this works well
Yes first update all your plugins related to flutter and dart .
"AndroidAPK Support" plugin(install /enable /update).
3.This will work for all the AS , checked this on AS 3.4 also .
Thanks to the guys who answered before me .
I also ran into this issue and the steps above didn't work. What I did was check which plugins I have enabled and realized that Android APK Support and Android NDK Support was disabled in my AS. After enabling this and restarting android studio everything seems to be working correctly.
This worked for me. Install Dart and Flutter manually from Plugins:
Open Plugins (For Mac: Configure -> Plugins OR Android Studio -> Preferences -> Plugins)
Search for Dart -> Search in repositories -> Install -> Restart Android studio
Search for Flutter -> Search in repositories -> Install -> Restart Android Studio
Got the same problem, fixed it by installing dart first using the plugin manager of android studio. Then install flutter plugin.
How to set flutter wizard in Android Studio 3.0
File > Close Project
Configure > Check for Updates
You will find Flutter and Dart updates. Update and Restart. Downloading Patch.
File > New Flutter Project or Select new Flutter Project.
Hope your problem resolved.
Happy Codings!!
It was little different in my case. After upgrading to newest release of Android studio. The dart flutter and other related plugins were in incompatible mode.
You can check that by going to Android Studio=> Plugins.
I simply update those plugins and then restart the IDE and it works fine.
Just Restore your IDE settings as shown in image
File -> Manage Ide Settings -> Restore default settings
This will remove your installed plugins and ask you again to install them.
Update flutter using below command
flutter upgrade
and again create flutter application from android studio
For some reason, Flutter refused to show New Flutter Project in android studio 3.1
but when I use android studio 3.2 it works fine after installing Dart and flutter plugins.
Make sure you have flutter and dart installed, then enable Android apk support; this helped me
Uninstall Flutter and Dart plugin
Restart Android Studio
Install Flutter Plugin (it will prompt you to install Dart plugin as well. Accept it)
Restart Android Studio
Also, reminder to check whether the plugin is enabled or not. Go to Preferences -> Plugins -> Flutter/Dart. Although, it's enabled by default, you may have had to disable it at some point in the past. In that case, just enable it from Preferences -> Plugin -> Flutter/Dart if you want to.
In my case I did not have APK/NDK support Plugin, added that and it worked. Of course restart IDE couple of times.
Well go to command line and check flutter doctor , if all good give command to your project directory
flutter create appname
and import this to androidstudio , this will generate necessary plugins.
I've got the same problem and finally sorted out. It's usually caused by your upgrade of Android Studio from 2.x to 3.x at the same time.
In short, it's because Flutter is not correctly configurated, but behind the scene there might be different reasons, so the universal solution is to run flutter doctor -v to diagnose and see what's missing.
[First make sure you've already followed the setup steps in Flutter's official documentation and have your Android SDK updated.]
In my own case, a couple of things to fix:
Update the JAVA_HOME path in .bash_profile. Because I have 2 Java versions installed and so I updated it to use the same as Android Studio does. This is critical as flutter doctor relies on Java to check some of your configurations.
Some Android licenses not accepted - follow flutter doctor's advice to accept all licenses.
Android Studio's Flutter plugin version too low - simply update it.
Even if you have done everything here,it may not work if you have Android Studio 4.x or canary
It works only in lower version
In my case I only miss Dart plugin so i installed and on IDE restart it was there