How to run flutter projects with different/older Dart SDK dependencies?
I had a similar problem:
My pubspec.yaml had the following:
environment:
sdk: ">=2.1.0 <3.0.0"
However when running flutter packages get
I got the following error:
Running "flutter packages get" in xxx-app-mobile...
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297.
Because xxx_app requires SDK version >=2.1.0 <3.0.0, version solving failed.
pub get failed (1)
I tried using the exact version name as the environment variable it did not work. I tried:
flutter upgrade
flutter clean
flutter update-packages
Received the same error when running flutter packages get
I then downgraded the version requirements in the pubspec.yaml to:
environment:
sdk: ">=2.0.0 <3.0.0"
And flutter packages get
worked...
Comments
-
Sebin Benjamin over 1 year
The current Dart SDK version is 2.1.0-dev.9.4.flutter-f9ebf21297. Because NewsBuzz requires SDK version >=1.8.0 <2.0.0, version solving failed.
I am trying to run projects from https://startflutter.com. There are several older projects using older versions of Dart SDK or with dependencies requiring older Dart SDK version.
Is there any way to run multiple versions of Dart without downloading the older version of Dart and changing the environment variables manually?
I have gone through several StackOverflow posts and lot of Github issues without finding a proper solution.
Specifying SDK version in the
pubspec.yaml
does not seem to help.environment: sdk: ">=2.0.0-dev.68.0 <3.0.0"
Edit: Dart & Flutter support for Visual Studio Code docs says something about
dart.sdkPaths
anddart.flutterSdkPaths
settings.-
Günter Zöchbauer over 5 yearsClone and update
NewsBuzz
to work with current Dart/Flutter versions. Ideally make a Pull Request afterwards to the original package. -
Sebin Benjamin over 5 yearsI don't wish to update every flutter app I come across. I was hoping to run it isolated without having to upgrade/downgrade my flutter installation. Like we do with angular/ionic apps or NPM (npmjs.com).
-
-
vrnvorona about 2 yearsUnless you work on pet project, you can't just upgrade in production app.