Am I using Flutter Preview 1 - dart

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

Related

Downgrade SDK Dart to build App on MacBook

I have an old MacBook here, and I need to build an app on it to test on an iPhone, the problem is that the app was created using the newest version of flutter. And as you may know, MacBook does not allow to install Flutter in XCode older than Flutter version 13,
and I was wondering if I would downgrade the Dart/Flutter SDK I will have problems and how to solve them?
the message displayed on console is:
[!] Xcode - develop for iOS and macOS (Xcode 12.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
! Flutter recommends a minimum Xcode version of 13.
Download the latest version or update via the Mac App Store.
• CocoaPods version 1.10.1
Yes, you can install other versions of flutter to build your application with it. You can either do so manually or use the flutter version manager (fvm) for that.
Download links for all flutter releases can be found in the flutter documentation.
These older releases of flutter then have different requirements for the Xcode versions.

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.

Flutter stuck on Building Dart code after doing flutter build ios

I'm trying to build an archive by doing flutter build ios but I encounter a problem on Starting Xcode build
$ flutter build ios
Building com.example.example for the device (ios-release)...
Automatically signing iOS for device deployment using specified
development team in Xcode project: XXXXXX
Running pod install...
Starting Xcode build...
├─Building Dart code...
I already build an archive one (last week) and it was working. Maybe this is due to flutter upgrade ?
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.11.3, on Mac OS X 10.14.1 18B75, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK
28.0.3)
[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
[✓] Android Studio (version 3.2)
[✓] VS Code (version 1.29.1)
That's an issue that was fixed very recently and the fix should already be available in the master channel.
flutter channel master
flutter doctor
You can also try dev channel, but I'm not sure if it landed there already.
The fix will of course be included in the next beta channel, but a beta release just came out last week, so it will probably take a while to the next.
See also https://github.com/flutter/flutter/issues/24139

Flutter Error: The current Flutter SDK version is 2.1.0-dev.0.0.flutter-be6309690f

I've just upgraded my flutter, after upgradation I am unable to run any flutter project on my Android Studio. I am getting this error message.
The current Dart SDK version is 2.1.0-dev.0.0.flutter-be6309690f.
Because buddy depends on flutter_built_redux 0.4.5 which requires SDK
version >=1.19.0 <2.0.0, version solving failed.
pub get failed (1)
How can I downgrade Dart or how can I resolve this issue, I am running android studio on mac.
I've tried by changing flutter channels dev and master but it doesn't make a difference.
flutter doctor -v result:
[✓] Flutter (Channel dev, v0.6.0, on Mac OS X 10.13.4 17E202, locale en-IN)
• Flutter version 0.6.0 at /Users/pro/Downloads/flutter
• Framework revision 9299c02cf7 (5 days ago), 2018-08-16 00:35:12 +0200
• Engine revision e3687f70c7
• Dart version 2.1.0-dev.0.0.flutter-be6309690f
[✓] Android toolchain - develop for Android devices (Android SDK 27.0.3)
• Android SDK at /Users/pro/Library/Android/sdk
• Android NDK location not configured (optional; useful for native
profiling support)
• Platform android-27, build-tools 27.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-
1024-b01)
• All Android licenses accepted.
[✓] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 9.4.1, Build version 9F2000
• ios-deploy 1.9.2
• CocoaPods version 1.5.0
[✓] Android Studio (version 3.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 27.1.1
• Dart plugin version 173.4700
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b01)
[!] Connected devices
! No devices available
flutter_built_redux package doesn't met the flutter dependency.
The error is caused by package not by flutter sdk.
see here
https://github.com/davidmarne/flutter_built_redux/blob/master/pubspec.yaml#L22
AND
you can post issue on flutter_built_redux package using this link
https://github.com/davidmarne/flutter_built_redux/issues/new?title=support%20for%20flutter%20sdk%202.1.0.dev&body=please%20upgrade%20the%20package%20for%20new%20flutter%20releases
Flutter includes a bundled Dart SDK (under its bin/cache directory) pinned to the same version used in the engine that we compile into your shipping iOS/Android app. As such, the only way to use Flutter with a different version of Dart is to use an older version of Flutter.
To do this, cd to the Flutter SDK directory. You can list the available versions by running git tag. To switch to a version, use git checkout. For example, to switch to v0.8.1 you’d run git checkout v0.8.1. When you’d like to switch back to the beta channel, run git checkout beta.
That said, generally I’d advise you to stick to beta and file an issue (or send a pull request) to the maintainer of any packages that haven’t yet been updated to Dart 2. You may also want to check the dependencies listed in your pubspec.yaml to see if there are newer versions available on pub.dartlang.org. It may just be a matter of updating your dependencies to a newer version.
I guess this is an quiver package dependency problem. Once in an update i had face same issue. That time i solve this by adding this lines to pubspec.yaml
dependency_overrides:
quiver: ^2.0.0+1
Flutter has the following channels, in increasing order of stability:
master
dev
beta
stable
Generally, I’d advise you to stick to the beta it works fine with all the packages.
It's not necessary but i think you should have to install Android Studio again with latest version.then add flutter and dart plugin there then Add Flutter SDK path in settings>Plugins>Flutter>Sdk-Path so locate your flutter sdk that you have installed in your PC may be located at C so add that path.And it may work.
And must have latest Flutter and Dart SDK installed.
You can download flutter SDK from here:
https://flutter.dev/docs/development/tools/sdk/releases

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