putPtr method
H
putPtr(
- P value,
- H f()
Implementation
H putPtr(P value, H Function() f) {
if (value == nullptr) {
throw AssertionError('Value is null');
}
final existing = from[value]?.target;
if (existing != null) {
return existing;
}
final key = f();
if (to[key] != null) {
return key;
}
acquire(value);
to[key] = value;
from[value] = WeakReference(key);
finalizer.attach(key, value);
return key;
}