RuntimeArtifact.fromJson constructor

RuntimeArtifact.fromJson(
  1. Object? j
)

Implementation

factory RuntimeArtifact.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return RuntimeArtifact(
    name: switch (json['name']) {
      null => '',
      Object $1 => decodeString($1),
    },
    type: switch (json['type']) {
      null => null,
      Object $1 => ArtifactTypeSchema.fromJson($1),
    },
    uri: switch (json['uri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    properties: switch (json['properties']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): Value.fromJson(e.value),
      },
      _ => throw const FormatException('"properties" is not an object'),
    },
    customProperties: switch (json['customProperties']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): Value.fromJson(e.value),
      },
      _ => throw const FormatException('"customProperties" is not an object'),
    },
    metadata: switch (json['metadata']) {
      null => null,
      Object $1 => protobuf.Struct.fromJson($1),
    },
  );
}