Baseflow / flutter_cache_manager

Generic cache manager for flutter
https://baseflow.com
MIT License
738 stars 427 forks source link

Upgrade to Dart 3 to compatibility with http ^1.0.0 #414

Closed Carapacik closed 1 year ago

Carapacik commented 1 year ago

Update dependencies Update example to latest version Fix analysis and format issues

Also update cached_network_image PR

Carapacik commented 1 year ago

413

Sreeharikr commented 1 year ago

Yeah.... I can't upgrade http package and packages depending on http.

Carapacik commented 1 year ago

I agree with rxdart, and upgraded the rest to support null safety.

Carapacik commented 1 year ago

Also check my PR for cached_network_image please

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 83.33% and project coverage change: -0.22 :warning:

Comparison is base (28e081e) 75.39% compared to head (06dbb27) 75.18%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #414 +/- ## =========================================== - Coverage 75.39% 75.18% -0.22% =========================================== Files 22 22 Lines 691 685 -6 =========================================== - Hits 521 515 -6 Misses 170 170 ``` | [Impacted Files](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow) | Coverage Δ | | |---|---|---| | [.../lib/src/cache\_managers/default\_cache\_manager.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvY2FjaGVfbWFuYWdlcnMvZGVmYXVsdF9jYWNoZV9tYW5hZ2VyLmRhcnQ=) | `0.00% <ø> (ø)` | | | [...utter\_cache\_manager/lib/src/config/\_config\_io.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvY29uZmlnL19jb25maWdfaW8uZGFydA==) | `12.50% <ø> (ø)` | | | [flutter\_cache\_manager/lib/src/logger.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvbG9nZ2VyLmRhcnQ=) | `75.00% <ø> (-5.00%)` | :arrow_down: | | [...cache\_info\_repositories/cache\_object\_provider.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvc3RvcmFnZS9jYWNoZV9pbmZvX3JlcG9zaXRvcmllcy9jYWNoZV9vYmplY3RfcHJvdmlkZXIuZGFydA==) | `0.00% <0.00%> (ø)` | | | [...torage/cache\_info\_repositories/helper\_methods.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvc3RvcmFnZS9jYWNoZV9pbmZvX3JlcG9zaXRvcmllcy9oZWxwZXJfbWV0aG9kcy5kYXJ0) | `100.00% <ø> (ø)` | | | [...info\_repositories/non\_storing\_object\_provider.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvc3RvcmFnZS9jYWNoZV9pbmZvX3JlcG9zaXRvcmllcy9ub25fc3RvcmluZ19vYmplY3RfcHJvdmlkZXIuZGFydA==) | `0.00% <0.00%> (ø)` | | | [...er/lib/src/storage/file\_system/file\_system\_io.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvc3RvcmFnZS9maWxlX3N5c3RlbS9maWxlX3N5c3RlbV9pby5kYXJ0) | `0.00% <0.00%> (ø)` | | | [...\_info\_repositories/json\_cache\_info\_repository.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvc3RvcmFnZS9jYWNoZV9pbmZvX3JlcG9zaXRvcmllcy9qc29uX2NhY2hlX2luZm9fcmVwb3NpdG9yeS5kYXJ0) | `90.62% <94.44%> (ø)` | | | [flutter\_cache\_manager/lib/src/cache\_manager.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvY2FjaGVfbWFuYWdlci5kYXJ0) | `88.15% <100.00%> (-0.16%)` | :arrow_down: | | [...er/lib/src/cache\_managers/image\_cache\_manager.dart](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow#diff-Zmx1dHRlcl9jYWNoZV9tYW5hZ2VyL2xpYi9zcmMvY2FjaGVfbWFuYWdlcnMvaW1hZ2VfY2FjaGVfbWFuYWdlci5kYXJ0) | `100.00% <100.00%> (ø)` | | | ... and [7 more](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow) | | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/Baseflow/flutter_cache_manager/pull/414/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Baseflow)

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Carapacik commented 1 year ago

Analyzer and format issues fixed

ryanheise commented 1 year ago

Hi thanks for the nice PR. Also thanks for the cleanup throughout the code. However, this makes it a bit harder for me to spot the really important differences.

It might be helpful to update CONTRIBUTING.md with guidelines to keep the diffs minimal in a pull request to aid the review process, and to avoid addressing multiple unrelated issues in a single pull request. I can see how reviewing 110 changed files for a PR that upgrades a dependency could be somewhat uncomfortable.

Carapacik commented 1 year ago

@renefloor, Is it worth updating build_runner min version to 2.0.0? Since previous versions support Dart < 2.12. build_runner is still only needed to generate for mockito.

renefloor commented 1 year ago

I'm testing the code now on the oldest and newest Flutter versions, hope you don't mind pushing some fixes directly?

Carapacik commented 1 year ago

I'm testing the code now on the oldest and newest Flutter versions, hope you don't mind pushing some fixes directly?

No problem

Carapacik commented 1 year ago

@renefloor Do you mind if I make some changes to delete unused rows in example to pass analysis?

renefloor commented 1 year ago

I'm currently also still making some changes, so maybe better to wait and not create (many) merge conflicts.

It's too hard to keep the current minimum. I would have to allow flutter_lints 1.0.4, but that means that various developers can have different set of warnings. Setting the minimum to Dart 2.17.0 and Flutter 3.0.0, which are both over 1 year old.

Carapacik commented 1 year ago

I'm currently also still making some changes, so maybe better to wait and not create (many) merge conflicts.

It's too hard to keep the current minimum. I would have to allow flutter_lints 1.0.4, but that means that various developers can have different set of warnings. Setting the minimum to Dart 2.17.0 and Flutter 3.0.0, which are both over 1 year old.

flutter_lines and other dev_dependencies dependencies do not affect the operation of package versions. That is, if dev_dependencies has the minimum version 2.17, and dependencies 2.12, then the package will have version 2.12.

Carapacik commented 1 year ago

If anything, I would recommend putting a minimum 2.19 version of dart for the package. Since it is the last one that supports no-sound-null-safety.

renefloor commented 1 year ago

That is, if dev_dependencies has the minimum version 2.17, and dependencies 2.12, then the package will have version 2.12.

I expect so as well, but it did complain if I try to add it as a dependency in another clean project.

renefloor commented 1 year ago

@Carapacik it looks good to me now, you agree? I'm ignoring the code coverage now.

Carapacik commented 1 year ago

Now yes

renefloor commented 1 year ago

I wonder if anybody will ever run this as real compiled app 😆

Carapacik commented 1 year ago

of course it will compile

renefloor commented 1 year ago

I meant for this change in the example:

      if (kDebugMode) {
        print(error);
      }
Carapacik commented 1 year ago

@renefloor cached_network_image next?

renefloor commented 1 year ago

cached_network_image next?

I now have to start really working, but probably can look at it tomorrow.

I think it should work fine already though. flutter_cache_manager: ^3.3.0 should automatically resolve to 3.3.1 and I don't see any other conflicting dependencies. Only the sdk should be <4.0.0, but I believe that is basically ignored for Dart 3.0.0?

Carapacik commented 1 year ago

cached_network_image next?

I now have to start really working, but probably can look at it tomorrow.

I think it should work fine already though. flutter_cache_manager: ^3.3.0 should automatically resolve to 3.3.1 and I don't see any other conflicting dependencies. Only the sdk should be <4.0.0, but I believe that is basically ignored for Dart 3.0.0?

There is still file ^7.0.0 used and there is an error with types somewhere. Also in that PR, the example has been updated.

renefloor commented 1 year ago

@Carapacik published flutter_cache_manager: https://pub.dev/packages/flutter_cache_manager/versions/3.3.1