简体   繁体   English

如何从我的 Flutter 应用程序控制网络缓存?

[英]How to control Network caching from my Flutter app?

For example, https://docs.flutter.io/flutter/services/NetworkImage-class.html says that cache headers are ignored.例如, https : //docs.flutter.io/flutter/services/NetworkImage-class.html说缓存头被忽略。 My understanding is iOS has an NSUrlCache on disk and it would be nice to be able to enable that.我的理解是 iOS 在磁盘上有一个 NSUrlCache,能够启用它会很好。 Similarly, I suspect Android has a disk cache which would be nice to enable.同样,我怀疑 Android 有一个磁盘缓存,启用它会很好。

Can I control Flutter's caching?我可以控制 Flutter 的缓存吗? Should I write my own disk cache/caching strategy in Dart on top of/in-front of NetworkImage?我应该在 NetworkImage 的顶部/前面在 Dart 中编写自己的磁盘缓存/缓存策略吗?

We do not currently have a good way to do this, unfortunately.不幸的是,我们目前没有一个好的方法来做到这一点。 You could provide your own ImageProvider similar to NetworkImageProvider that had its own cache and implemented the network semantics correctly.您可以提供自己的 ImageProvider,类似于 NetworkImageProvider,它有自己的缓存并正确实现了网络语义。 We would certainly accept that as a patch if you contributed it.如果你贡献了它,我们当然会接受它作为补丁。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何以编程方式从我的 Flutter 应用程序启动应用程序? - How do I launch an app from my Flutter app programmatically? 如何从我的 flutter-android 应用程序打开 whatssap 应用程序 - How to open whatssap app from my flutter-android app 如何在我的应用程序中启用网络和GPS定位? - how to enable network and gps location from within my app? 在 flutter 中控制网络图像质量 - Control network image quality in flutter 如何让我的音量控制应用程序在颤动的系统音量变化中立即响应(飞镖) - How can I make my volume control app response instantly in system volume change in flutter(dart) 如何控制在我的应用程序在颤振/飞镖的后台活动期间创建的 object? - How to control an object that's been created during my app's background activity in flutter/dart? 如何从其他应用程序启动我的 Flutter 应用程序 - How can I Launch My Flutter App from other Apps 如何将我的位置从 flutter app 分享到 whatsapp 号码? - How to share my location from flutter app to whatsapp number? 如何控制谁可以从 Play 商店安装我的应用程序? - How to control who can install my app from play store? 如何通过我的Android应用控制背景音乐? - How to control background music from my Android app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM