add method

void add(
  1. String name,
  2. Image image
)

Adds the image into the cache under the key name.

The cache will assume the ownership of the image, and will properly dispose of it at the end.

Implementation

void add(String name, Image image) {
  _assets[name]?.dispose();
  _assets[name] = _ImageAsset.fromImage(image);
}