getCached<T> method

T getCached<T>(
  1. String key,
  2. T compute()
)

Implementation

T getCached<T>(String key, T Function() compute) {
  if (!_cache.containsKey(key)) {
    _cache[key] = compute();
  }
  return _cache[key] as T;
}