dependency issues why I try to run/debug my app - flutter

I'm new to making an app with flutter/dart and I'm running into some issues with the dependecies in the pubspec.yaml. I'm trying to make an app from a template to learn about how to work with repositories from github. After I brought in the code and repaired all the errors I tried to run/debug it and keep getting this from the output terminal:
Because google_sign_in >=5.4.0 depends on google_sign_in_platform_interface ^2.2.0 which depends on quiver ^3.0.0, google_sign_in >=5.4.0 requires quiver ^3.0.0.
And because cloud_firestore >=0.14.0-dev.1 <0.17.0-1.0.nullsafety.0 depends on quiver ^2.0.0, google_sign_in >=5.4.0 is incompatible with cloud_firestore >=0.14.0-dev.1 <0.17.0-1.0.nullsafety.0.
Because cloud_firestore >=0.13.3 <0.14.0-dev.1 depends on firebase_core ^0.4.4 and cloud_firestore >=0.11.0 <0.13.3 depends on firebase_core ^0.4.0, cloud_firestore >=0.11.0 <0.14.0-dev.1 requires firebase_core ^0.4.0.
Thus, if google_sign_in >=5.4.0 and cloud_firestore >=0.11.0 <0.17.0-1.0.nullsafety.0 then firebase_core ^0.4.0.
And because txapita depends on cloud_firestore >=0.11.0 <0.14.0+1, google_sign_in >=5.4.0 requires firebase_core ^0.4.0.
So, because txapita depends on both firebase_core ^2.4.1 and google_sign_in ^5.4.2, version solving failed.
pub get failed (1; So, because txapita depends on both firebase_core ^2.4.1 and google_sign_in ^5.4.2, version solving failed.)
exit code 1
Also, how do I get rid of txapita from the whole project if I can. It seems a lot of the code in the repository needs that package but I can't find the source package.
I've tried changing the versions to the versions in the error message
Here is my pubspec with things I've tried:
If I change the name to the name of the app it adds more errors to the output terminal when I save, is that how I get rid of the packages from the code?
name: txapita
description: A new Flutter application.
version: 1.0.0+1
environment:
sdk: ">=2.2.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
## I've tried doing this with the version numbers
cloud_firestore: ">=0.11.0 <0.14.0+1"
cupertino_icons: null
firebase_auth: null
firebase_core: ^2.4.1
firebase_messaging: ^14.2.1
flutter_google_places: null
flutter_spinkit: ^4.1.2
geocoder: null
geoflutterfire: ^2.0.3+6
geolocator: null
google_maps_flutter: ^2.2.3
google_maps_webservice: null
http: null
location: null
modal_bottom_sheet: ^0.2.2
percent_indicator: ^2.1.7+2
provider: null
rxdart: any
shared_preferences: ^2.0.15
uuid: null
url_launcher: ^5.0.3
get_it: ^1.0.3+2
get: ^4.6.5
share_plus: ^6.3.0
google_sign_in: ^5.4.2
path_provider: ^2.0.11
path_provider_windows: ^2.1.3
shared_preferences_windows: ^2.1.2
path_provider_platform_interface: ^2.0.0
platform: ^3.1.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter:
uses-material-design: true

Rather than using null or any find the package version by searching the package.
Link to PUB: https://pub.dev/
E.g. : cloud_firestore: ^4.3.1
Try running flutter pub upgrade --major-versions

Related

How to resolve version conflicts between packages?

I'm making a function to record voice and save it as a file. However, an error occurred when pub get to the pubspec.yaml file.
Because every version of flutter_audio_recorder depends on file ^5.0.4 and shared_preferences_windows >=2.0.0 depends on file ^6.0.0, flutter_audio_recorder is incompatible with shared_preferences_windows >=2.0.0.
And because shared_preferences 2.0.9 depends on shared_preferences_windows ^2.0.0 and no versions of shared_preferences match >2.0.9 <3.0.0, flutter_audio_recorder is incompatible with shared_preferences ^2.0.9.
So, because mirinae_gugu depends on both shared_preferences ^2.0.9 and flutter_audio_recorder ^0.5.5, version solving failed.
pub get failed (1; So, because mirinae_gugu depends on both shared_preferences ^2.0.9 and flutter_audio_recorder ^0.5.5, version solving failed.)
The package I am using is below.
cupertino_icons: ^1.0.2
provider: ^6.0.0
carousel_slider: ^4.0.0
rxdart: ^0.27.2
font_awesome_flutter: ^9.1.0
shared_preferences: ^2.0.9
flutter_signin_button: ^2.0.0
image_picker: ^0.7.0
path_provider: ^2.0.2
sizer: ^2.0.15
get: 3.24.0
flutter_svg: ^0.19.1
intl: ^0.17.0
cached_network_image: ^3.1.0
camera: ^0.9.2
google_speech: ^2.0.1
sound_stream: ^0.3.0
flutter_animation_progress_bar: ^2.0.1
noise_meter: ^3.0.2
rflutter_alert: ^2.0.2
audioplayers: ^0.19.1
fluttertoast: ^8.0.7
share: ^2.0.4
permission_handler: ^8.1.4+1
flutter_audio_recorder: ^0.5.5
Even though I fixed the error between flutter_audio_recorder and shared_preferences, I still get the error between different packages.
How can I solve this?
Run flutter clean. Then
In pubspec.yaml give
audioplayers: any
Delete pubspec.lock. Then run flutter pub get and flutter run. It should work as expected
Use flutter_audio_recorder2 instead. This is an exact clone of flutter_audio_recorder but it supports dart null-safety support.
flutter_audio_recorder2: ^0.0.2
Not Recommended Solution (using old flutter_audio_recorder package).
Below is the solution using flutter_audio_recorder. This is the opened pull request #58 - Added sound null safety support. So you can use it like below
Change the flutter_audio_recorder dependencies like below
flutter_audio_recorder:
git:
url: git://github.com/fayeed/flutter_audio_recorder.git
ref: sound-null-safety
Use dependency override, suppose some_package and another_package depends on incompatible url_launcher version, you can resolve conflict this way:
dependencies:
some_package:
another_package:
dependency_overrides:
url_launcher: '5.4.0'

flutter packages get command gives an error error

hello I tried running flutter pub get and I was faced with this error:
flutter pub get
Waiting for another flutter command to release the startup lock...
Running "flutter pub get" in Deutsche-Flutter...
Because every version of flutter_test from sdk depends on test_api 0.3.0 and mockito 4.1.4 depends on test_api ^0.2.19-nullsafety, flutter_test from sdk is incompatible with mockito 4.1.4.
And because no versions of mockito match >4.1.4 <5.0.0, flutter_test from sdk is incompatible with mockito ^4.1.4.
So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.
pub get failed (1; So, because deutsche depends on both mockito ^4.1.4 and flutter_test any from sdk, version solving failed.)
exit code 1
I already ran flutter upgrade and tried to run flutter pub get here are my dependencies:
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.0
flutter_svg: ^0.19.1
flutter_bloc: ^6.1.2
get: ^3.23.1
rxdart: ^0.19.0
http: ^0.12.2
google_fonts: ^0.3.9
circular_countdown_timer: ^0.1.0
pin_code_fields: ^2.4.0
google_nav_bar: ^3.2.0
line_icons: ^0.2.0
shared_preferences: ^0.5.12+4
flutter_launcher_icons: ^0.7.2+1
rive: ^0.6.8
timer_count_down: ^1.0.4+1
logger: ^0.9.4
dartz: ^0.9.0-dev.6
freezed_annotation: ^0.12.0
bloc_test: ^7.1.0
mockito: ^4.1.4
jwt_decode: ^0.3.1
carousel_slider: ^3.0.0
dev_dependencies:
build_runner:
freezed: ^0.12.7
flutter_test:
sdk: flutter
Update all of your plugins and that will work. And do make sure that all of them are null-safety enabled.
try replacing mokito version as any as follows.
mockito: any
then check the pubspeck.lock file and search mokito and take that version number from there and replace it in pubspec.yaml file
update the mockito package to => mockito: ^5.2.0

Can't install permission_handler and file_picker because of cloud_firestore

I want to get data from Firestore, put it into a list and enable to user to download data on phone in CSV format by using app.
I found two solutions how to export data to CSV file on phone, but both solutions contains packages which I can't install.
Solution #1
How to create and export csv file in flutter?
Dependencies #1
dependencies:
page_view_indicators: ^2.0.0
syncfusion_flutter_xlsio: ^19.1.64-beta
csv: ^5.0.0
ext_storage: ^1.0.3
permission_handler: ^8.0.0+1
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
Problem #1
Because cloud_firestore >=0.13.1 <0.14.0-dev.1 depends on cloud_firestore_platform_interface ^1.0.0 which depends on plugin_platform_interface ^1.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 requires plugin_platform_interface ^1.0.0.
And because permission_handler >=8.0.0 depends on permission_handler_platform_interface ^3.5.0 which depends on plugin_platform_interface ^2.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 is incompatible with permission_handler >=8.0.0.
So, because gamiforms depends on both permission_handler ^8.0.0+1 and cloud_firestore ^0.13.3, version solving failed.
pub get failed (1; So, because gamiforms depends on both permission_handler ^8.0.0+1 and cloud_firestore ^0.13.3, version solving failed.)
exit code 1
Solution #2
https://medium.com/flutterdevs/exploring-csv-in-flutter-fafc57b02eb1
Dependencies #2
dependencies:
page_view_indicators: ^2.0.0
syncfusion_flutter_xlsio: ^19.1.64-beta
csv: ^5.0.0
ext_storage: ^1.0.3
file_picker: ^3.0.1
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
Problem #2
Because cloud_firestore >=0.13.1 <0.14.0-dev.1 depends on cloud_firestore_platform_interface ^1.0.0 which depends on plugin_platform_interface ^1.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 requires plugin_platform_interface ^1.0.0.
And because file_picker >=3.0.0-nullsafety.3 depends on plugin_platform_interface ^2.0.0, cloud_firestore >=0.13.1 <0.14.0-dev.1 is incompatible with file_picker >=3.0.0-nullsafety.3.
So, because gamiforms depends on both file_picker ^3.0.1 and cloud_firestore ^0.13.3, version solving failed.
pub get failed (1; So, because gamiforms depends on both file_picker ^3.0.1 and cloud_firestore ^0.13.3, version solving failed.)
exit code 1
How to fix one of these problems or is there any another way how to export data to phone via app?
I've never done this before and every advice is welcome.
EDIT
dev_dependencies:
flutter_test:
sdk: flutter
cached_network_image: ^2.0.0
cloud_firestore: ^0.13.3
firebase_auth: ^0.15.2
provider: ^3.2.0
#google_sign_in: ^4.1.1
shared_preferences: ^0.5.6+3
random_string: ^2.0.1
In both the cases, you cloud_firestore is way too old. I see that the current version is
cloud_firestore: ^2.2.0
So, unless there is some problem with this version, you should migrate it to the latest version, which should be depending on a later version of plugin_platform_interface
cloud_firestore: ^2.2.0 depends on cloud_firestore_platform_interface: ^5.1.0 which depends on plugin_platform_interface: ^2.0.0.
So, change your pubsec.yaml file to have,
cloud_firestore: ^2.2.0
Then run, flutter pub get.

Flutter - v 1.24.0 to 2.0.5 - pubspec.yaml version problems

I have downloaded flutter_windows_2.0.5-stable.zip and installed Flutter 2.0.5.
When I run a v1.24.0 project, I get the following output:
Running "flutter pub get" in get_json ...
The current Dart SDK version is 2.12.0-29.10.beta.
Because flutter_easyloading 3.0.0 requires SDK version >=2.12.0 <3.0.0 and no versions of flutter_easyloading match >3.0.0 <4.0.0, flutter_easyloading ^3.0.0 is forbidden.
So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.
pub get failed (1; So, because get_json depends on flutter_easyloading ^3.0.0, version solving failed.)
Contents of pubspec.yaml:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^2.0.0 #^4.0.1
rflutter_alert: ^1.1.0 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^1.0.7 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^2.0.0 #^4.1.1
Looking around the Internet I found
Update to/install latest Flutter packages (pubspec.yaml)
At the end of this it is stated that in Flutter 2 it will help to run
1 flutter pub outdated and
2 flutter pub upgrade --major-versions
Running 1 "flutter pub outdated" gives a looot of output and ends with:
Changed 75 dependencies!
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
No changes to pubspec.yaml!
Running 2 "flutter pub upgrade --major-versions" also gives a lot of output and ends with:
...
No dependencies changed.
25 packages have newer versions incompatible with dependency constraints.
Try `flutter pub outdated` for more information.
Changed 4 constraints in pubspec.yaml:
json_annotation: ^2.0.0 -> ^4.0.1
rflutter_alert: ^1.1.0 -> ^2.0.2
webview_flutter: ^1.0.7 -> ^2.0.4
json_serializable: ^2.0.0 -> ^4.1.1
pubspec.yaml was changed to:
dependencies:
flutter:
sdk: flutter
http: ^0.12.2
json_annotation: ^4.0.1 #^4.0.1
rflutter_alert: ^2.0.2 #^2.0.2
pdf_flutter: ^1.1.4
syncfusion_flutter_pdfviewer: ^18.4.49-beta
webview_flutter: ^2.0.4 #^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.1
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.0.0
json_serializable: ^4.1.1 #^4.1.1
Now I try run my (old) project again which results in the following output:
Running "flutter pub get" in get_json...
The current Dart SDK version is 2.12.0-29.10.beta.
Because no versions of json_serializable match >4.1.1 <5.0.0 and json_serializable 4.1.1 requires SDK version >=2.12.0 <3.0.0, json_serializable ^4.1.1 is forbidden.
So, because get_json depends on json_serializable ^4.1.1, version solving failed.
pub get failed (1; So, because get_json depends on json_serializable ^4.1.1, version solving failed.)
I have tried many variations of what is described above, but I am stuck.
Can anyone help or guide me in the right direction? Thank you.
==============================
Thank you to Ujjwal Raijada. I got Flutter 2 because of web support and did not think of null safety. However, I have now followed the migration guide to the detail and now have the following pubspec.yaml:
environment:
sdk: '>=2.12.0 <3.0.0'
dependencies:
flutter:
sdk: flutter
http: ^0.13.1
json_annotation: ^4.0.1
rflutter_alert: ^2.0.2
#pdf_flutter: ^1.1.4 # Package pdf_flutter is not null safe and therefore cannot be used ...
syncfusion_flutter_pdfviewer: ^19.1.57-beta
webview_flutter: ^2.0.4
flutter_easyloading: ^3.0.0
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^2.0.1
json_serializable: ^4.1.1
I have also changed my code as suggested by the migration guide. so now I run "flutter packages pub run build_runner build" which results in:
The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
pub finished with exit code 65
Pressing "pub get" in pubspec.yaml gives the following result:
The current Dart SDK version is 2.12.0-29.10.beta.
Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because get_json requires SDK version >=2.12.0 <3.0.0, version solving failed.)
Process finished with exit code 1
What should I do now? Any help out there? Thank you.

pub get failed:version solving failed

Flutter_test depends on meta 1.1.8 and firebase_login depends on meta ^1.2.2.
firebase_login depends on flutter_test any from sdk, version solving failed.
pub get failed
pubspec.yaml
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_auth: ^0.18.0+1
equatable: ^1.2.4
google_sign_in: ^4.5.3
meta: ^1.2.2
cupertino_icons: ^0.1.3
dev_dependencies:
flutter_test:
sdk: flutter
lint: any
You can get both by
dependencies:
meta: ^1.2.2
dependency_overrides:
meta: ^1.1.8
I have same problem with bloc:
Because every version of passcode_navigator from git depends on flutter_bloc ^7.3.3 and every version of feature_menu from path depends on flutter_bloc ^8.0.0, passcode_navigator from git is incompatible with feature_menu from path
I resolve it with adding to pubspec:
dependency_overrides:
flutter_bloc: any
Do this,
meta: ^1.1.8
And then, run this,
flutter pub get
hi there try to downgrade the version of meta to 1.1.8 i tried and it worked with me in flutter 1.20.1
I experienced a similar issue with Firebase auth and permission_handler:
# pubspec.yaml:
dependencies:
flutter:
sdk: flutter
firebase_auth: ^1.4.1
permission_handler: ^5.1.0+2
The error message (truncated):
Because permission_handler ^5.1.0 depends on permission_handler_platform_interface ^2.0.2 which depends on plugin_platform_interface ^1.0.2, permission_handler ^5.1.0 requires plugin_platform_interface ^1.0.2.
And because firebase_auth 1.4.1 depends on firebase_core_platform_interface ^4.0.1 and no versions of firebase_auth match >1.4.1 <2.0.0, permission_handler ^5.1.0 is incompatible with firebase_auth ^1.4.1.
So, because my_flutter_project depends on both firebase_auth ^1.4.1 and permission_handler ^5.1.0+2, version solving failed.
A solution that worked for me:
Update permission_handler to the latest version:
flutter pub add permission_handler
Update meta to 1.2.2
meta: ^1.2.2
also update flutter using flutter upgrade command
flutter upgrade