You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
first of all, I'm thrilled by the elegance of your internal design. so it was pretty easy to add an SvgCachedNetworkLoader
classSvgCachedNetworkLoaderextendsSvgLoader<File> {
/// See class doc.constSvgCachedNetworkLoader(
this.url, {
this.headers,
super.theme,
super.colorMapper,
});
/// The [Uri] encoded resource address.finalString url;
/// Optional HTTP headers to send as part of the request.finalMap<String, String>? headers;
@overrideFuture<File> prepareMessage(BuildContext? context) async {
returnawait _cacheManager.getSingleFile(url, headers: headers);
}
@overrideStringprovideSvg(File? message) {
finalUint8List bytes = message!.readAsBytesSync();
return utf8.decode(bytes, allowMalformed:true);
}
@overrideintget hashCode =>Object.hash(url, headers, theme, colorMapper);
@overridebooloperator==(Object other) {
return other isSvgCachedNetworkLoader&&
other.url == url &&
other.headers == headers &&
other.theme == theme &&
other.colorMapper == colorMapper;
}
@overrideStringtoString() =>'SvgCachedNetworkLoader($url)';
}
Besides that I find it amazing that it is possible to pass a File to compute I wasn't sure if I need to do any special error handling in case prepareMessage or provideSvg throws an exception or if that is totally ok if they do.
The text was updated successfully, but these errors were encountered:
Hi @dnfield,
first of all, I'm thrilled by the elegance of your internal design. so it was pretty easy to add an
SvgCachedNetworkLoader
Besides that I find it amazing that it is possible to pass a
File
tocompute
I wasn't sure if I need to do any special error handling in caseprepareMessage
orprovideSvg
throws an exception or if that is totally ok if they do.The text was updated successfully, but these errors were encountered: