getOrCompute<T> method
T?
getOrCompute<T>(
- K key,
- T computation()
Implementation
T? getOrCompute<T>(K key, T Function() computation) {
final thiz = this;
if (thiz == null) return computation();
final value = thiz[key];
if (value is T) {
return value;
}
return computation();
}