1

When I run my Flutter codes, I get an error like this:

Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:

 - package:firebase_auth

For solutions, see https://dart.dev/go/unsound-null-safety

Restarted application in 922ms.

pubspec.yaml:

name: simto_todolist
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
androidX: true

environment:
  sdk: ">=2.15.1 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.2
  firebase_auth: ^0.6.2+1

dev_dependencies:
  flutter_test:
    sdk: flutter
  global_configuration: ^1.6.0
  flutter_lints: ^1.0.0
  get_storage: ^2.0.3
  carousel_slider: ^4.0.0
  cool_alert: ^1.1.0
  timer_count_down: ^2.2.1
  modal_bottom_sheet: ^2.0.1
  persistent_bottom_nav_bar: ^4.0.2
  group_button: ^4.6.0
  flutter_signin_button: ^2.0.0
  google_sign_in: ^5.2.4
  firebase_core: ^1.13.1

flutter:
  uses-material-design: true
  assets:
  - splash1.png
  - splash2.png
  - splash3.png
  - splash4.png
  - logo.png
  
  fonts:
  - family: Roboto
    fonts:
    - asset: fonts/Roboto-Bold.ttf
    - asset: fonts/Roboto-Light.ttf
    - asset: fonts/Roboto-Medium.ttf
    - asset: fonts/Roboto-Thin.ttf

I think the problem is in the firabase_auth package. I've searched a lot but couldn't find how to fix the problem.

What is the problem? How can I solve it? Thanks in advance for the help.


@MuhammadJunaidKhalid When I upgrade the firebase_auth version to the latest version, I get this output:

Because no versions of global_configuration match >1.6.0 <2.0.0 and global_configuration 1.6.0 depends on http ^0.12.2, global_configuration ^1.6.0 requires http ^0.12.2.
And because no versions of http match >0.12.2 <0.13.0 and http 0.12.2 depends on http_parser >=0.0.1 <4.0.0, global_configuration ^1.6.0 requires http_parser >=0.0.1 <4.0.0.
And because firebase_auth >=3.3.9 depends on firebase_auth_web ^3.3.9 which depends on http_parser ^4.0.0, global_configuration ^1.6.0 is incompatible with firebase_auth >=3.3.9.
So, because simto_todolist depends on both firebase_auth ^3.3.11 and global_configuration ^1.6.0, version solving failed.
pub get failed (1; So, because simto_todolist depends on both firebase_auth ^3.3.11 and global_configuration ^1.6.0, version solving failed.)
exit code 1

The error I got after doing what @Royalindo said:

PS C:\Users\emiry\Desktop\Simto-To-Do-List\simto_todolist> flutter pub get
Because no versions of global_configuration match >1.6.0 <2.0.0 and global_configuration 1.6.0 depends on http ^0.12.2, global_configuration ^1.6.0 requires http ^0.12.2.
And because no versions of http match >0.12.2 <0.13.0 and http 0.12.2 depends on http_parser >=0.0.1 <4.0.0, global_configuration ^1.6.0 requires http_parser >=0.0.1 <4.0.0.
And because firebase_auth >=3.3.9 depends on firebase_auth_web ^3.3.9 which depends on http_parser ^4.0.0, global_configuration ^1.6.0 is incompatible with firebase_auth >=3.3.9.
So, because simto_todolist depends on both firebase_auth ^3.3.11 and global_configuration ^1.6.0, version solving failed.
Running "flutter pub get" in simto_todolist...                          
pub get failed (1; So, because simto_todolist depends on both firebase_auth ^3.3.11 and global_configuration ^1.6.0, version solving failed.)
Emir Bolat
  • 899
  • 3
  • 14
  • 37
  • https://www.geeksforgeeks.org/dart-null-safety/#:~:text=Null%20Safety%20in%20simple%20words,be%20shown%20in%20compile%20time. try to read this, and this https://stackoverflow.com/questions/64917744/cannot-run-with-sound-null-safety-because-dependencies-dont-support-null-safety –  Mar 26 '22 at 13:06
  • i think the problem was because you use the global_configuration packages that didnt support null safety, https://pub.dev/packages/global_configuration –  Mar 26 '22 at 13:08
  • @Royalindo I tried removing the `global_configuration` package and still got the same issue. – Emir Bolat Mar 26 '22 at 13:17
  • @Royalindo I also checked the links you provided and unfortunately there was no solution. – Emir Bolat Mar 26 '22 at 13:18
  • Update the package version that might will help – Muhammad Junaid Khalid Mar 26 '22 at 13:18
  • https://pub.dev/packages/firebase_auth check this out – Muhammad Junaid Khalid Mar 26 '22 at 13:20
  • @MuhammadJunaidKhalid I installed firebase_auth package as final version and it failed. I edited the topic and added it. Thanks for answers. – Emir Bolat Mar 26 '22 at 13:22
  • 1
    https://pub.dev/packages/firebase_auth/install the version already far ahead. try to change your dependencies to ` firebase_auth: ^3.3.11` and run `flutter pub get` at your terminal –  Mar 26 '22 at 13:23
  • @Royalindo Exactly my point – Muhammad Junaid Khalid Mar 26 '22 at 13:24
  • @Royalindo I did what you said and got a version error. I've added the error. – Emir Bolat Mar 26 '22 at 13:28
  • uhm did you create your app on the test folder? or in lib folder? –  Mar 26 '22 at 13:28
  • All of my app codes are in the `lib` folder. – Emir Bolat Mar 26 '22 at 13:29
  • well cut all your dependecies that in dev_dependecies:/file: and paste it below firebase_auth, try it might be work –  Mar 26 '22 at 13:30

1 Answers1

0

In the Dart file

Add // @dart=2.9 at the top in your main.dart file.

// @dart=2.9 import 'package:flutter/material.dart';

void main() {   //... } 

Using the command line

flutter run --no-sound-null-safety Or to be specific (say in Chrome)

flutter run -d chrome --no-sound-null-safety