123456789101112131415161718192021222324252627282930313233343536 |
- import 'package:fis_common/logger/logger.dart';
- import 'package:flutter/foundation.dart';
- import 'package:vid/us/vid_us_image.dart';
- /// Vid图像获取
- abstract class VidImageFetcherBase {
- late final String _url;
- /// 图像缓存(未释放时保持)
- @protected
- VidUsImage? cache;
- VidImageFetcherBase(String url) {
- _url = url;
- }
- /// vid链接
- String get url => _url;
- /// 获取图像
- Future<VidUsImage?> fetch() async {
- try {
- cache ??= await innerFetch();
- return cache!;
- } catch (e) {
- logger.e('VidImageFetcherBase - fetch vid image fail', e);
- }
- return null;
- }
- @protected
- Future<VidUsImage?> innerFetch();
- /// 释放资源
- void dispose();
- }
|