opt: cache image (#1787)

This commit is contained in:
My-Responsitories
2025-12-22 10:43:32 +08:00
committed by GitHub
parent 952d168022
commit d80324655e
5 changed files with 45 additions and 57 deletions

View File

@@ -124,12 +124,10 @@ class _CachedNetworkSVGImageState extends State<CachedNetworkSVGImage> {
Future<void> _loadImage() async {
try {
var file = (await widget._cacheManager.getFileFromCache(_cacheKey))?.file;
file ??= await widget._cacheManager.getSingleFile(
final file = await widget._cacheManager.getSingleFile(
widget._url,
key: _cacheKey,
headers: widget._headers ?? {},
headers: widget._headers ?? const {},
);
final svg = await file.readAsString();
_svgString = svg;