buildCachedView<T> method

  1. @protected
T buildCachedView<T>(
  1. T builder(),
  2. Object? cacheKey
)
inherited

Returns a cached view if the cache key matches.

Implementation

@protected
T buildCachedView<T>(T Function() builder, Object? cacheKey) {
  if (_cachedView != null && _cachedViewKey == cacheKey) {
    return _cachedView as T;
  }
  final result = builder();
  _cachedView = result;
  _cachedViewKey = cacheKey;
  return result;
}