picture method
The cached picture for spec at size, built by build on a miss.
Implementation
ui.Picture picture(
BackgroundSpec spec,
Size size,
ui.Picture Function() build,
) {
final key = (spec, size);
final hit = _pictures.remove(key);
if (hit != null) return _pictures[key] = hit;
builds++;
final picture = _pictures[key] = build();
while (_pictures.length > capacity) {
_pictures.remove(_pictures.keys.first)?.dispose();
}
return picture;
}