lcpContentSize property

double? get lcpContentSize

Gets the size of the largest contentful element if available

Implementation

double? get lcpContentSize {
  final lcpPhase = phases.firstWhere(
    (phase) => phase.name == LoadingState.phaseLargestContentfulPaint,
    orElse: () => LoadingPhase(name: '', timestamp: DateTime.now()),
  );

  if (lcpPhase.name.isEmpty) return null;

  final size = lcpPhase.parameters['largestContentSize'];
  if (size is num) {
    return size.toDouble();
  }
  return null;
}