snapshot method

CockpitSnapshot snapshot()

Implementation

CockpitSnapshot snapshot() {
  return _withDiscoveryCache(() {
    final targets = visibleTargets;
    final prioritizedTargets = _prioritizeForLiveSnapshot(targets);
    final truncatedTargets = prioritizedTargets
        .take(liveSnapshotTargetLimit)
        .map(_liveSnapshotTarget)
        .toList(growable: false);

    return CockpitSnapshot(
      routeName: routeName,
      visibleTargets: truncatedTargets,
      truncated: prioritizedTargets.length > liveSnapshotTargetLimit,
      summary: CockpitSnapshotSummary(
        visibleTargetCount: targets.length,
        targetsWithCockpitIdCount: targets
            .where((target) => target.cockpitId != null)
            .length,
        targetsWithTextCount: targets
            .where((target) => target.text != null && target.text!.isNotEmpty)
            .length,
        styleDetailsIncluded: false,
        diagnosticPropertiesIncluded: false,
        ancestorSummariesIncluded: false,
        rebuildSummaryIncluded: false,
        accessibilitySummaryIncluded: false,
      ),
    );
  });
}