loadImage static method
/////////////////////////////////////////////////////////
Loading Image and using memory caching
/////////////////////////////////////////////////////////
Implementation
static Future<ImgTexture> loadImage(
{dynamic path,
dynamic image,
dynamic url,
String? baseUrl,
String? key,
Function? onLoad,
Function? onError,
bool cache = true}) async {
var href = path ?? image ?? url;
href = ZKAssets.getPath(href, baseUrl);
var f = (path) async {
ui.Image img = await ImgLoader.load(path: path);
return ImgTexture(img);
};
return await memCache.load(
path: href,
key: key,
cache: cache,
load: f,
onLoad: onLoad,
onError: onError);
}