tryAdaptAutoValidated static method

ValidatedChartAutoSwitchResult tryAdaptAutoValidated(
  1. Map<String, dynamic> json, {
  2. List<ChartType>? preferredOrder,
  3. bool includeCurrentType = false,
  4. bool registeredOnly = true,
  5. bool deep = true,
  6. bool requireRegisteredType = true,
})

Non-throwing auto-switch plus post-switch validation.

Implementation

static ValidatedChartAutoSwitchResult tryAdaptAutoValidated(
  Map<String, dynamic> json, {
  List<ChartType>? preferredOrder,
  bool includeCurrentType = false,
  bool registeredOnly = true,
  bool deep = true,
  bool requireRegisteredType = true,
}) {
  final result = tryAdaptAuto(
    json,
    preferredOrder: preferredOrder,
    includeCurrentType: includeCurrentType,
    registeredOnly: registeredOnly,
  );
  return ValidatedChartAutoSwitchResult(
    switchResult: result,
    validation: _validateSwitchedPayload(
      result.payload,
      deep: deep,
      requireRegisteredType: requireRegisteredType,
    ),
  );
}