deniza / app_tracking_transparency

A Flutter plugin to show ios 14+ tracking authorization dialog.
https://pub.dev/packages/app_tracking_transparency/
MIT License
83 stars 28 forks source link

depends on app_tracking_transparency >=2.0.0 which requires SDK version >=2.12.0 <3.0.0, version solving failed #21

Closed niranjan-b-prajapati closed 2 years ago

niranjan-b-prajapati commented 2 years ago

I want to use this library but when I try to add it in my pubspec.yaml file and do pub get it gives me below error:

Running "flutter pub get" in my_app                       
The current Dart SDK version is 2.7.2.

Because my_app depends on app_tracking_transparency >=2.0.0 which requires SDK version >=2.12.0 <3.0.0, version solving failed.
pub get failed (1; Because my_app depends on app_tracking_transparency >=2.0.0 which requires SDK version >=2.12.0 <3.0.0, version solving failed.)
exit code 1

Following is the output of flutter --version command :

Flutter 1.12.13+hotfix.9 • channel stable • https://github.com/flutter/flutter.git
Framework • revision f139b11009 (1 year, 5 months ago) • 2020-03-30 13:57:30 -0700
Engine • revision af51afceb8
Tools • Dart 2.7.2

I can't upgrade flutter to latest version as it is client requirement that we can't upgrade flutter.

Please help me resolve this issue.

untp commented 2 years ago

If you can't upgrade flutter, you must use an old version of this package.

Try app_tracking_transparency: ^1.1.0

There shouldn't be a problem with using old version. Only difference between 2.0.0 and 1.1.0 is null safety. Null safety came with flutter 2.0.

niranjan-b-prajapati commented 2 years ago

@untp thank you for your suggestion but when I tried using version 1.1.0 it gave me the following error:

The current Flutter SDK version is 1.12.13+hotfix.9.

Because my_app depends on app_tracking_transparency >=1.0.0+1 which requires Flutter SDK version >=1.20.0 <2.0.0 or >=2.0.0, version solving failed.
pub get failed (1; Because my_app depends on app_tracking_transparency >=1.0.0+1 which requires Flutter SDK version >=1.20.0 <2.0.0 or >=2.0.0, version solving failed.)
exit code 1

It expects the flutter version to be 1.20.0 or greater.

How can I solve this as my Flutter version is 1.12.13+hotfix.9

untp commented 2 years ago

Yes, you are right. Also first version (1.0.0) of this package still depends on flutter 1.20. There is no version that satisfy flutter 1.12. So you need to download and modify it for your requirements.

You can download any version from https://pub.dev/packages/app_tracking_transparency/versions You should download 1.1.0+1 which is the latest version that not migrated to null safety. (https://storage.googleapis.com/pub-packages/packages/app_tracking_transparency-1.1.0%2B1.tar.gz)

Create a directory called packages or third_party or something in your project. Extract to that directory.

Modify ./packages/app_tracking_transparency/pubspec.yaml:

environment:
  sdk: ">=2.7.0 <3.0.0"
  flutter: ">=1.12.0 <2.0.0"

Then edit your project's pubspec:

dependencies:
  app_tracking_transparency:
    path: packages/app_tracking_transparency
niranjan-b-prajapati commented 2 years ago

@untp Thank you so much for the solution. I was able to implement the library in my Flutter version.

Thanks a ton for the prompt response.

Please close the issue.