resolve static method

ChartRuntimePerformancePolicyResolution resolve(
  1. Object? json, {
  2. ChartRuntimePerformancePolicy fallback = ChartRuntimePerformancePolicy.defaults,
})

Implementation

static ChartRuntimePerformancePolicyResolution resolve(
  Object? json, {
  ChartRuntimePerformancePolicy fallback =
      ChartRuntimePerformancePolicy.defaults,
}) {
  final match = _runtimePerformancePolicyMatch(json);
  if (match == null) {
    return ChartRuntimePerformancePolicyResolution.fallback(fallback);
  }

  final policy = fallback.copyWith(
    largeDatasetPointThreshold: ChartRuntimePerformancePolicyFields.readInt(
      match.map,
      ChartRuntimePerformancePolicyFields.largeDatasetPointThresholdAliases,
    ),
    cachePressureWarningThreshold:
        ChartRuntimePerformancePolicyFields.readRatio(
          match.map,
          ChartRuntimePerformancePolicyFields
              .cachePressureWarningThresholdAliases,
        ),
    lowRenderCacheHitRateThreshold:
        ChartRuntimePerformancePolicyFields.readRatio(
          match.map,
          ChartRuntimePerformancePolicyFields
              .lowRenderCacheHitRateThresholdAliases,
        ),
    lowRenderCacheMinRequests: ChartRuntimePerformancePolicyFields.readInt(
      match.map,
      ChartRuntimePerformancePolicyFields.lowRenderCacheMinRequestsAliases,
    ),
  );
  return ChartRuntimePerformancePolicyResolution.json(
    policy,
    sourcePath: match.path,
  );
}