由于CachedNetworkImage
不在 flutter web 上工作,在移植时,我尝试使用它,但我的问题是我们真的需要它吗?或者我们只使用 Image。网络和浏览器和服务工作者将处理缓存部分(然后由服务器的响应头设置,例如 cache-control="max-age=43200, public"
这用于我正在从事的食品配送项目,https://www.santaiyamcha.com
下面是我用来替换 CachedNetworkImage 的类,它似乎不能很好地工作。
import 'package:flutter/material.dart';
import 'package:http/http.dart';
import 'package:http_extensions_cache/http_extensions_cache.dart';
import 'package:http_extensions/http_extensions.dart';
/// Builds a widget when the connectionState is none and waiting
typedef LoadingBuilder = Widget Function(BuildContext context);
/// Builds a if some error occurs
typedef ErrorBuilder = Widget Function(BuildContext context, Object error);
class MeetNetworkImage extends StatelessWidget {
/// Image url that you want to show in your app.
final String imageUrl;
/// When image data loading from the …
Run Code Online (Sandbox Code Playgroud)