putHandle method
P
putHandle(
- H key,
- P f()
Implementation
P putHandle(H key, P Function() f) {
final existing = to[key];
if (existing != null) {
return existing;
}
final value = f();
if (value == nullptr) {
throw AssertionError('Builder returned null: $key');
}
if (from.containsKey(value)) {
return value;
}
acquire(value);
to[key] = value;
from[value] = WeakReference(key);
finalizer.attach(key, value);
return value;
}