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

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".

Related

Could not find package flutter_localization in the Flutter SDK

I am currently trying to implement localization in my Flutter App but whenever I try to add the dependency for flutter_localization, I get the following error Message:
Because the timer depends on flutter_localization from SDK which doesn't exist (could not find package flutter_localization in the Flutter SDK), version solving failed.
I have also correctly added the path to both my flutter and dart SDKs in Android Studio.
Here is my pubspec.yaml file:
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
intl: ^0.17.0-nullsafety.2
cupertino_icons: ^1.0.2
sqflite: any
shared_preferences: ^2.0.15
path_provider: any
flutter_localization:
sdk: flutter
flutter_cupertino_localizations: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
I can't access GlobalMaterialLocalizations without flutter_localization and apparently, this is the easiest solution. I have already tried many solutions like checking version compatibilities and updating all dependencies. can you guys help me out?
Thanks in Advance!
Upgrading SDKs, Upgrading Dependencies, reinstalling flutter and Dart, and more
You misspelled the package
Replace
flutter_localization:
sdk: flutter
With
flutter_localizations:
sdk: flutter
Take note on the s on flutter_localizations

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: Pubspec.yaml Error for Analyzer and injectable_generator versions to run build_runner

I cant use build_runner: ^2.1.11 in flutter without adding analyzer: ^4.2.0.when its add it's possible to generate build_runner files like .g.dart and freezed.dart without any issues. but when it comes to injectable_generator: ^1.5.3 I can't even add injectable generator to the pubspec as it shows error due to analyzer.
My needs where about:
Running flutter pub run build_runner build --delete-conflicting-outputs without adding analyzer.
2.which version of analyzer is used to make compatible with injactable_runner to support for build_runner.
3.Is there any alternative otpion to fix this issue to compine verisons.
please check my pubsec file and analys e the error in it.
dependencies:
analyzer: ^4.2.0
bordered_text: ^2.0.0
cupertino_icons: ^1.0.2
dartz: ^0.10.1
dio: ^4.0.6
flutter:
sdk: flutter
flutter_bloc: ^8.0.1
freezed_annotation: ^2.0.3
get_it: ^7.2.0
google_fonts: ^3.0.1
http: ^0.13.4
injectable: ^1.5.3
json_annotation: ^4.5.0
json_serializable: ^6.3.0
video_player: ^2.4.5
dev_dependencies:
build_runner: ^2.1.11
flutter_lints: ^2.0.0
flutter_test:
sdk: flutter
freezed: ^2.0.4
You must add dependency_overrides to your pubspec.yaml:
dependency_overrides:
analyzer: ^4.2.0

Because calendar depends on table_calendar >=2.3.0 which requires Flutter SDK version >=1.17.0, version solving failed

I have this error while running pubget table_calendar (^3.0.3) in my Calendar app. Here is my pubspec file
name: calendar
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
table_calendar: ^3.0.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
flutter:
uses-material-design: true
i am not getting any error , its work totally fine with me with the same packages and sdk
you can try changing the sdk version to sdk: ">=1.17.0 <3.0.0"
name: getx_test_1
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
get: ^4.6.1
table_calendar: ^3.0.3
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^1.0.0
flutter:
uses-material-design: true
Seems weird that you are trying to do a pub get on table_calendar: ^3.0.3 but the error is being thrown trying to get table_calendar >= 2.3.0. I would look around that area.

Problem in importing some Flutter package

I can't import the firebase_auth package in Flutter. I did everything they said in the installation part (as shown below). Other packages are imported and working properly, but firebase_auth isn't.
name: flash_chat
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.1.0<3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
animated_text_kit: ^2.2.0
firebase_core: ^0.5.0
firebase_auth_platform_interface: ^2.0.1
firebase_auth_web: ^0.3.0+1
firebase_core_platform_interface: ^2.0.0
cloud_firestore: ^0.14.0+2
firebase_analytics: ^6.0.0
firebase_messaging: ^7.0.0
firebase_auth: ^0.18.0+1
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- images/
And I did the pub get. Can anybody help me?
These are a few suggested solutions:
Reload your IDE
Delete your pubspec.lock file and re run pub get.