i am new in flutter and installed it on my device, but i got error when running flutter pub get
like this :
Building flutter tool...
Cannot open file, path = '.packages' (OS Error: Permission denied, errno = 13)
Running "flutter pub get" in mobile-sev2...
pub get failed (66; Cannot open file, path = '.packages' (OS Error: Permission
denied, errno = 13))
and then i'm trying to run it with sudo command and got error
The current Flutter SDK version is 0.0.0-unknown.
Because fluttertoast 8.0.9 requires Flutter SDK version >=1.10.0 and no versions of fluttertoast match >8.0.9 <9.0.0, fluttertoast ^8.0.9 is forbidden.
So, because mobile_sev2 depends on fluttertoast ^8.0.9, version solving failed.
Running "flutter pub get" in mobile-sev2...
pub get failed (1; So, because mobile_sev2 depends on fluttertoast ^8.0.9,
version solving failed.)
this is my flutter version
Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 77d935af4d (6 months ago) • 2021-12-16 08:37:33 -0800
Engine • revision 890a5fca2e
Tools • Dart 2.15.1 ```
Related
I see that in the pubspec the Dart SDK version is specified/constrained but is there anywhere to specify the Flutter SDK version? Maybe I'm missing something obvious but coming from other tech stacks like Java/Gradle I believe normally SDK versions are explicit?
What got me thinking about this is that I'm using Codemagic and have my Flutter version at "default" but I can't even tell what that is from their docs or their build logs.
You can get that from your terminal just run flutter --version, this will print out your current flutter SDK and dart SDK versions.
flutter --version
the result should be similar to this
Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b06b8b2710 (2 weeks ago) • 2023-01-23 16:55:55 -0800
Engine • revision b24591ed32
Tools • Dart 2.19.0 • DevTools 2.20.1
Look like it's easy to limit it like this - I just missed it in the doc.
If I say I need ^4.0.0 then I get a meaningful error:
environment:
sdk: '>=2.18.6 <3.0.0'
flutter: ^4.0.0
Running "flutter pub get" in XXXX... Resolving
dependencies... The current Flutter SDK version is 3.7.1.
Because XXXX requires Flutter SDK version >=4.0.0, version
solving failed. pub get failed command:
"/opt/homebrew/Caskroom/flutter/3.3.10/flutter/bin/cache/dart-sdk/bin/dart
__deprecated_pub --directory . get --example" pub env: { "FLUTTER_ROOT": "/opt/homebrew/Caskroom/flutter/3.3.10/flutter",
"PUB_ENVIRONMENT": "flutter_cli:get", "PUB_CACHE":
"/Users/DENNCH3/.pub-cache", } exit code: 1
I'm trying to upgrade Flutter version in my project from 2.8.0 to 3.7.0. If I got it right flutter should be using the default version installed on my machine, but it doesn't. See commands below.
flutter --version
Flutter 3.7.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 9944297138 (4 days ago) • 2023-02-08 15:46:04 -0800
Engine • revision 248290d6d5
Tools • Dart 2.19.2 • DevTools 2.20.1
Still it tries to use previous version
flutter pub get
Running "flutter pub get" in xxx...
Resolving dependencies...
Because xxx depends on flutter >=3.0.0 which doesn't match any versions, version solving failed.
pub get failed
command: "/usr/local/Caskroom/flutter/2.8.0/flutter/bin/cache/dart-sdk/bin/dart __deprecated_pub --color
--directory . get --example"
pub env: {
"FLUTTER_ROOT": "/usr/local/Caskroom/flutter/2.8.0/flutter",
"PUB_ENVIRONMENT": "flutter_cli:get",
"PUB_CACHE": "/Users/yyy/.pub-cache",
}
exit code: 1
you could try :
flutter clean
flutter pub get
if it repeats, maybe you could:
flutter clean
flutter pub upgrade
I am having some errors with my flutter project as seen below.
I tried flutter upgrade, flutter clean, nothing is working to solve this issue.
Output from flutter pub get:
flutter pub get
Running "flutter pub get" in demo_app_1...
The current Dart SDK version is 2.14.4.
Because demo_app_1 depends on cloud_firestore >=3.1.10 which requires SDK version >=2.16.0 <3.0.0, version solving failed.
pub get failed (1; Because demo_app_1 depends on cloud_firestore >=3.1.10 which requires SDK version >=2.16.0 <3.0.0, version solving failed.)
exit code 1
flutter --version in terminal :
flutter --version
Flutter 3.1.0-0.0.pre.847 • channel master • https://github.com/flutter/flutter.git
Framework • revision 7459332538 (61 minutes ago) • 2022-05-21 02:33:07 -0400
Engine • revision 0264282e8b
Tools • Dart 2.18.0 (build 2.18.0-139.0.dev) • DevTools 2.13.1\
Thank you for your help.
in the pubspec.yaml you define the flutter sdk version (detailed information see here: Flutter and the pubspec file)
your importent part is the
environment:
sdk: ">=2.7.0 <3.0.0"
here you define the sdk version and like the error message says, cloud_firestore requires a SDK version between 2.16.0 and 3.0.0
so you have to adjust these version to reach the requirements
i'm a flutter starter and currntly adding firebase authentication to my project.
i added firebase_auth and and cloud_firestore to pubspec.yaml file using command lines
flutter pub add firebase_auth
flutter pub add cloud_firestore
dependenices are
"cupertino_icons: ^1.0.2
cloud_firestore: ^2.0.0
firebase_auth: ^1.1.3"
when trying to run my project i'm getting the error
The current Dart SDK version is 2.12.0-133.2.beta.
Because firebase_auth 1.1.3 requires SDK version >=2.12.0 <3.0.0 and no versions of firebase_auth match >1.1.3 <2.0.0, firebase_auth ^1.1.3 is forbidden.
So, because elected_ones depends on firebase_auth ^1.1.3, version solving failed.
pub get failed (1; So, because elected_ones depends on firebase_auth ^1.1.3, version solving failed.)
in the error it says the Dart SDK version is 2.12.0-133.2.beta
but when i run flutter --version i get
Flutter 2.0.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 1d9032c7e1 (8 days ago) • 2021-04-29 17:37:58 -0700
Engine • revision 05e680e202
Tools • Dart 2.12.3
being trying to figure it out and i got totally lost between the '''dart pub upgrade''' and '''dart pub outdated''' through transitive dependecies
problem solved by directing the IDE to correct folder where correct sdk sits
run in terminal (in project root)
flutter doctor -v
path will be shown in the first line
I was developing a project on my laptop and moved to my desktop, so I got some errors. I updated flutter and after that, I get this warning:
for (Offset center in scaleHandles) {
handles.add(Rect.fromCircle(center: center, radius: r));
}
"The named parameter 'center' isn't defined.
Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'center'.dartundefined_named_parameter" When I hover over "fromCircle" I get this tip "Rect Rect.fromCircle({dynamic Offset})". That doesn't make any sense! The official docs also state that a Rect from a circle takes CENTER and RADIUS. What's going on????
This is my flutter version:
G:>flutter doctor --version
Flutter 1.19.0-4.3.pre • channel beta • https://github.com/flutter/flutter.git
Framework • revision 8fe7655ed2 (3 weeks ago) • 2020-07-01 14:31:18 -0700
Engine • revision 9a28c3bcf4
Tools • Dart 2.9.0 (build 2.9.0-14.1.beta)
Before I updated to flutter beta, this is the error I got:
Running "flutter pub get" in spirals_app...
Because every version of flutter_test from sdk depends on path 1.6.4 and spirals_app depends on path ^1.7.0, flutter_test from sdk is forbidden.
So, because spirals_app depends on flutter_test any from sdk, version solving failed.
pub get failed (1; So, because spirals_app depends on flutter_test any from sdk, version solving failed.)
exit code 1
enter image description here
You will just need to run in your terminal the following commands
flutter clean
flutter pub get
and then you may need to restart your editor