fromJson static method

CockpitCaseSubmissionSource fromJson(
  1. Object? value, {
  2. String path = r'$',
})
override

Implementation

static CockpitCaseSubmissionSource fromJson(
  Object? value, {
  String path = r'$',
}) {
  final json = CockpitFoundationValueReader.object(value, path);
  final kind = CockpitFoundationValueReader.string(
    json['kind'],
    '$path.kind',
  );
  return switch (kind) {
    'inline' => CockpitInlineCaseSource.fromJson(value, path: path),
    'indexed' => CockpitIndexedCaseSource.fromJson(value, path: path),
    _ => throw FormatException('Unsupported case source kind at $path.kind.'),
  };
}