breakpoint property

FSBreakpoint get breakpoint

Get the current breakpoint based on screen width with LRU caching

Implementation

FSBreakpoint get breakpoint {
  final cacheKey = _BreakpointCacheKey(screenWidth, breakpoints);

  final cached = _breakpointCache.get(cacheKey);
  if (cached != null) {
    _cacheHits++;
    return cached;
  } else {
    _cacheMisses++;
    final calculated = breakpoints.getBreakpoint(screenWidth);
    _breakpointCache.set(cacheKey, calculated);
    return calculated;
  }
}