Attribution.fromJson constructor

Attribution.fromJson(
  1. Object? j
)

Implementation

factory Attribution.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Attribution(
    baselineOutputValue: switch (json['baselineOutputValue']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    instanceOutputValue: switch (json['instanceOutputValue']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    featureAttributions: switch (json['featureAttributions']) {
      null => null,
      Object $1 => protobuf.Value.fromJson($1),
    },
    outputIndex: switch (json['outputIndex']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeInt(i)],
      _ => throw const FormatException('"outputIndex" is not a list'),
    },
    outputDisplayName: switch (json['outputDisplayName']) {
      null => '',
      Object $1 => decodeString($1),
    },
    approximationError: switch (json['approximationError']) {
      null => 0,
      Object $1 => decodeDouble($1),
    },
    outputName: switch (json['outputName']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}