Error: Null safety features are disabled for this library - flutter

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.

Related

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.

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

Flutter dart null safety migration dont work because of package flutter_template_images

I want to migrate my project to null safety but the dependecie flutter_template_images is not supporting null safety:
Package Name Current Upgradable Resolvable Latest
direct dependencies:
flutter_template_images ✗4.0.0 ✗4.0.0 ✗4.0.0 ✗4.0.0
dev_dependencies: all support null safety.
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.
I dont know where this package comes from and I dont find it in the pubspec.yaml file. Can I migrate null safety without upgrading this dependencie?
EDIT:
This is my pubspec.yaml file:
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
material_design_icons_flutter: ^4.0.5955
pdf: ^3.3.0
path_provider: ^2.0.2
provider: ^6.0.0
open_file: ^3.2.1
intl: ^0.17.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
cloud_firestore: ^2.3.0
get: ^4.1.4
printing: ^5.4.3
google_sign_in: ^5.0.5
firebase_auth: ^3.0.1
fl_chart: ^0.36.3
url_launcher: ^6.0.9
sqflite: ^2.0.0+4
It appears the maintainer has not migrated the package to dart-null-safety, you could either wait for the maintainer to migrate the package or clone the package and migrate the package yourself.
Another option could be that you remove the package from your project.
For more clarification dart-null-safety

Dart SDK version mismatch

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

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