Dart SDK version mismatch - flutter

version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
hive: ^1.0.0
hive_flutter: ^0.2.1
path_provider: ^1.3.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
integration_test:
sdk: flutter
build_runner: ^2.1.1
hive_generator: ^0.5.1
pub get failed (1; Because depends on path_provider >=2.0.0 which requires SDK version >=2.12.0-259.9.beta <3.0.0, version solving failed.)
exit code 1
how to fix it?

Hi #Sreerekha and welcome to StackOverflow!
cupertino_icons: ^1.0.2 has null-safety enabled, so you have to:
upgrade your SDK to version 2.12 (or higher) and migrate all your app to null-safety,
or you have to downgrade the version of this dependency.
Unfortunately, you can't have the best of both worlds
How_to_migrate_to_null_safety
Cupertino_icons_versions

Related

Flutter - "flutter from sdk and syncfusion_flutter_datagrid ^19.1.65-beta, version solving failed." Error

I am getting an error like this:
Because every version of flutter from sdk depends on collection 1.16.0 and syncfusion_flutter_datagrid >=19.1.54-beta <20.1.48 depends on collection >=1.9.0 <=1.15.0, flutter from sdk is incompatible with syncfusion_flutter_datagrid >=19.1.54-beta <20.1.48.
So, because datagrid_json_datasource depends on both flutter from sdk and syncfusion_flutter_datagrid ^19.1.65-beta, version solving failed.
pubspec.yaml:
name: datagrid_json_datasource
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
http: ^0.12.0
flutter:
sdk: flutter
intl: ^0.17.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
syncfusion_flutter_datagrid: ^19.1.65-beta
flutter:
uses-material-design: true
i try too chenge sdk version when i change to sdk version and also try flutter clean and flutter pub get.
Try updating to newer version of syncfusion_flutter_datagrid.
Add to pubspec.yaml:
dependencies:
syncfusion_flutter_datagrid: ^20.3.52
Then run flutter pub get
I tested this with multiple Flutter versions and the one you should use is the 2.2.0 because this is the version which contains the Collector 1.9.0, you cannot use another version of Collector or override it because dart:Collector contains different data structures that are used in the code base of flutter.
This is the pubspec.yaml that works for me for Flutter 2.2.0
Hope it helps you :)
name: test_datasourcee
description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
syncfusion_flutter_datagrid: ^19.1.65-beta
flutter:
uses-material-design: true

Flutter build error: Dart 2.13.1 is incompatible with your dependencies' SDK constraints

I am relatively new to Flutter, and don't seem to be able to figure this out.
Here is my pubspec.yaml:
name: app
version: 1.0.0+1
environment:
sdk: ">=2.16.0-80.1.beta <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
flutter_login: ^3.1.0
font_awesome_flutter: ^9.2.0
flutter_secure_storage: ^5.0.2
flutter_bloc: ^8.0.1
shared_preferences: ^2.0.12
equatable: ^2.0.3
json_annotation: ^4.4.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
build_runner: ^2.1.7
flutter:
uses-material-design: true
I did of course try to run $(flutter) pub get, update flutter channel to the latest master and dev, run $flutter packages pub run build_runner watch, but to no avail...
The dev channel in particular lists "Dart 2.16.0 (build 2.16.0-134.1.beta)" as a dependency tool, but I still get the same compile error.
Just got back to this project, with a fresh mind, and I quickly fixed the issue by changing the environment sdk to ">=2.15.1 <3.0.0".

Error: Null safety features are disabled for this library

version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
The following adds the Cupertino Icons font to your application.
Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.1
dots_indicator: ^2.0.0
firebase_auth: ^1.2.0
cloud_firestore: ^2.2.0
firebase_core: ^1.2.0
provider: ^5.0.0
geolocator: ^7.0.3
google_maps_flutter: ^2.0.5
geocoder: ^0.2.1
flutter_spinkit: ^5.0.0
dev_dependencies:
flutter_test:
sdk: flutter
All of your dependencies are their latest versions and all of them have migrated to null safety.
Since you cannot intermix both null safe and non null safe packages together, you would need to migrate your code to code to null safety.
First, change your sdk as such,
environment:
sdk: ">=2.12.0 <3.0.0"
Then run pub get (this automatically runs once you save the file but you can run it if it doesn't automatically)
Next, migrate your code wherever necessary to use the new null safe features.

version solving failing not getting the sollution

This is my pubspec.yaml where I have added firebase_auth and cloud_firebase:
name: my_khata
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
firebase_auth: ^1.0.1
cloud_firestore: ^1.0.3
error I am getting:
The current Dart SDK version is 2.12.0-259.16.beta.
Because my_khata requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because my_khata requires SDK version >=2.12.0 <3.0.0, version solving failed.)
please tell me the solution
Try using this
cupertino_icons: ^1.0.2
firebase_core: ^1.0.2
firebase_auth: ^1.0.1
cloud_firestore: ^1.0.3
I think you need to check your flutter channel(Stable recommended) if above solution not working you can try any like this
firebase_auth: any
cloud_firestore: any

rxdart is not installing in my PC due to some issue in dart SDK version

I'm trying to install rxdart by copying it from https://pub.dev/packages/rxdart/versions/0.7.1#-installing-tab- , but its showing some error.
The current Dart SDK version is 2.3.0-dev.0.5.flutter-a1668566e5.
Because flutter_course depends on rxdart >=0.1.0+1 <0.16.0 which requires SDK version >1.12.0 <2.0.0, version solving failed.
pub get failed (1)
exit code 1
I tried using flutter upgrade.
But that doesn't change anything.
My pubsec.yaml file
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
scoped_model: ^1.0.1
http: ^0.12.0+2
shared_preferences: ^0.5.3+1
rxdart: ^0.7.1
dev_dependencies:
flutter_test:
sdk: flutter