Baseflow / Baseflow/flutter_cache_manager
Isolate imports and conditionally import libraries to make package platform-independent
- Lenguaje dominante
- Dart
- Estrellas
- 809
- Forks
- 510
- Merge medio
- 6 min
- PR fusionados (30 d)
- 1
Descripción
## 🏗 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
Guía de contribución
Línea de trabajo
Start by tracing the imports and exports of path_provider, file, and sqflite through cache_info_repositories/cache_info_repositories.dart and the config_*.dart files. Review the linked #321 discussion and the checklist, then determine how conditional imports and cross-platform cache-info storage should cover web and non-web platforms. Done means platform-dependent libraries are isolated and the package supports web according to the stated goal.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- dart, flutter
- Área
- mobile-dev
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 30/100