ExplanationMetadata.fromJson constructor

ExplanationMetadata.fromJson(
  1. Object? j
)

Implementation

factory ExplanationMetadata.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return ExplanationMetadata(
    inputs: switch (json['inputs']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): ExplanationMetadata_InputMetadata.fromJson(
            e.value,
          ),
      },
      _ => throw const FormatException('"inputs" is not an object'),
    },
    outputs: switch (json['outputs']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): ExplanationMetadata_OutputMetadata.fromJson(
            e.value,
          ),
      },
      _ => throw const FormatException('"outputs" is not an object'),
    },
    featureAttributionsSchemaUri:
        switch (json['featureAttributionsSchemaUri']) {
          null => '',
          Object $1 => decodeString($1),
        },
    latentSpaceSource: switch (json['latentSpaceSource']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}