PythonPackageSpec.fromJson constructor

PythonPackageSpec.fromJson(
  1. Object? j
)

Implementation

factory PythonPackageSpec.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return PythonPackageSpec(
    executorImageUri: switch (json['executorImageUri']) {
      null => '',
      Object $1 => decodeString($1),
    },
    packageUris: switch (json['packageUris']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"packageUris" is not a list'),
    },
    pythonModule: switch (json['pythonModule']) {
      null => '',
      Object $1 => decodeString($1),
    },
    args: switch (json['args']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) decodeString(i)],
      _ => throw const FormatException('"args" is not a list'),
    },
    env: switch (json['env']) {
      null => [],
      List<Object?> $1 => [for (final i in $1) EnvVar.fromJson(i)],
      _ => throw const FormatException('"env" is not a list'),
    },
  );
}