load method

  1. @override
dynamic load(
  1. dynamic url,
  2. Function onLoad, [
  3. Function? onProgress,
  4. Function? onError,
])
override

Implementation

@override
load(url, Function onLoad, [Function? onProgress, Function? onError]) async {
  String? cacheName;
  if (path != "" && url is String) {
    url = path + url;
    cacheName = url;
  }
  else if(url is Blob){
    cacheName = String.fromCharCodes(url.data).toString().substring(0,50);
  }

  url = manager.resolveURL(url);
  cacheName ??= url;
  var cached = Cache.get(cacheName!);

  if (cached != null) {
    manager.itemStart(cacheName);
    onLoad(cached);
    manager.itemEnd(cacheName);
    return cached;
  }

  final _resp = await ImageLoaderLoader.loadImage(url, flipY);
  Cache.add(cacheName,_resp);
  onLoad(_resp);

  return _resp;
}