Baseflow / Baseflow/flutter_cache_manager

Isolate imports and conditionally import libraries to make package platform-independent

オープン
#325 コメント 18 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Dart
スター
809
フォーク
510
平均マージ
6分
マージ済み PR(30日)
1

説明

## 🏗 Enhancement Proposal

Currently `flutter_cache_manager` is platform-independent, yet according to pub.dev, the package doesn't support web. This can be solved using conditionally importing `dart:io` dependent libraries.
`path_provider`, `file` and `sqflite` are platform-dependent and must only be imported/exported in *_io.dart files which will then be conditionally imported/exported.

`file` can be replaced with `cross_file` (as mentioned in [#321 (comment)](https://github.com/Baseflow/flutter_cache_manager/pull/321#issuecomment-854064553))

`path_provider` and `sqflite` are rather easy to isolate since they are imported only in cache_info_repositories which are selectively imported in config_*.dart files. The only problem is that `cache_info_repositories/cache_info_repositories.dart` is exported. @renefloor what can we do about this?

### Pitch

This will increase pub points which affect discoverability. Also, partially platform-dependent code will be separated and be easier to maintain.

### Checklist

- [ ] #339
- [ ] Store the config json data as a file on all platforms except the web, where web storage will be used to store this data
- [ ] Make the JSON implementation of cache info repository platform independent
- [ ] Migrate all instances to use the new JSON implementation
- [ ] If necessary, replace platform dependent dependencies with cross-platform implementations

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、cache_info_repositories/cache_info_repositories.dart と config_*.dart ファイルを通じて、path_provider、file、sqflite のインポートとエクスポートを追跡します。リンクされている #321 の議論とチェックリストを確認し、条件付きインポートとクロスプラットフォームのキャッシュ情報ストレージで web および非 web プラットフォームをどのようにカバーすべきかを判断します。プラットフォーム依存ライブラリが分離され、記載された目標に従ってパッケージが web をサポートすれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
dart, flutter
領域
mobile-dev
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
30/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。