cacheElement static method

void cacheElement(
  1. String refId,
  2. Element element,
  3. Map<String, dynamic> bounds
)

Cache element data for performance

Implementation

static void cacheElement(String refId, Element element, Map<String, dynamic> bounds) {
  final weakRef = WeakReference(element);
  _elementCache[refId] = {
    'bounds': bounds,
    'element': weakRef,
    'timestamp': DateTime.now().millisecondsSinceEpoch,
  };

  // Clean up old cache entries
  _cleanupCache();
}