removeReference method
Called when a source is dereferenced, e.g. by a stateful widget's State object being disposed. Throws an exception if there had been no matching call to addReferenceV2 for this source.
Implementation
void removeReference(ScalableImageSource src) {
_CacheEntry? e = _canonicalized[src];
if (e == null) {
throw ArgumentError.value(src, 'Not in cache', 'src');
} else if (e._refCount <= 0) {
throw ArgumentError.value(src, 'Extra attempt to removeReference', 'src');
}
assert(e._lessRecent == null);
assert(e._moreRecent == null);
e._refCount--;
if (e._refCount == 0) {
_addToLRU(e);
}
}