readImage function
tries to open an Image given by its name
and returns it if successful
Implementation
Future<Image?> readImage(String name, {int? cacheSize}) async {
//TODO: support reading images/file from indexedDb or something for web
final file = (await localFile(
name,
));
// ignore: unused_local_variable
final err = (name == Options().no_image_placeholder_name)
? NoImagePlaceholderException()
: Exception("file $file doesnt exist");
if (!file.existsSync())
// throw err;
return null;
if (file.lengthSync() < 5) throw Exception("file $file definitely to small");
//TO-DO: was wenn keine datei da lesbar ist? -> return null
// das ist wichtig damit der placeholder statt einem "image corrupt" dargestellt wird
return Image.file(await localFile(name),
cacheHeight: cacheSize, cacheWidth: cacheSize);
}