fetchOrGenerate method
If the image with name exists in the cache that is returned, otherwise
the image generated by imageGenerator is returned.
If the imageGenerator is used, the resulting Image is stored with
name in the cache.
Implementation
Future<Image> fetchOrGenerate(
String name,
Future<Image> Function() imageGenerator,
) {
return (_assets[name] ??= _ImageAsset.future(
imageGenerator(),
)).retrieveAsync();
}