tryAdaptValidated static method
Non-throwing switch plus post-switch validation.
Use this before building a runtime-selected chart when invalid payloads
should be reported instead of surfacing from KChart.build.
Implementation
static ValidatedChartTypeSwitchResult tryAdaptValidated(
Map<String, dynamic> json,
ChartType targetType, {
bool force = false,
bool registeredOnly = true,
bool deep = true,
bool requireRegisteredType = true,
}) {
final result = tryAdapt(
json,
targetType,
force: force,
registeredOnly: registeredOnly,
);
return ValidatedChartTypeSwitchResult(
switchResult: result,
validation: _validateSwitchedPayload(
result.payload,
deep: deep,
requireRegisteredType: requireRegisteredType,
),
);
}