BuildConfig.fromJson constructor

BuildConfig.fromJson(
  1. Object? j
)

Implementation

factory BuildConfig.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return BuildConfig(
    automaticUpdatePolicy: switch (json['automaticUpdatePolicy']) {
      null => null,
      Object $1 => AutomaticUpdatePolicy.fromJson($1),
    },
    onDeployUpdatePolicy: switch (json['onDeployUpdatePolicy']) {
      null => null,
      Object $1 => OnDeployUpdatePolicy.fromJson($1),
    },
    build: switch (json['build']) {
      null => '',
      Object $1 => decodeString($1),
    },
    runtime: switch (json['runtime']) {
      null => '',
      Object $1 => decodeString($1),
    },
    entryPoint: switch (json['entryPoint']) {
      null => '',
      Object $1 => decodeString($1),
    },
    source: switch (json['source']) {
      null => null,
      Object $1 => Source.fromJson($1),
    },
    sourceProvenance: switch (json['sourceProvenance']) {
      null => null,
      Object $1 => SourceProvenance.fromJson($1),
    },
    workerPool: switch (json['workerPool']) {
      null => '',
      Object $1 => decodeString($1),
    },
    environmentVariables: switch (json['environmentVariables']) {
      null => {},
      Map<String, Object?> $1 => {
        for (final e in $1.entries)
          decodeString(e.key): decodeString(e.value),
      },
      _ => throw const FormatException(
        '"environmentVariables" is not an object',
      ),
    },
    dockerRegistry: switch (json['dockerRegistry']) {
      null => BuildConfig_DockerRegistry.$default,
      Object $1 => BuildConfig_DockerRegistry.fromJson($1),
    },
    dockerRepository: switch (json['dockerRepository']) {
      null => '',
      Object $1 => decodeString($1),
    },
    serviceAccount: switch (json['serviceAccount']) {
      null => '',
      Object $1 => decodeString($1),
    },
  );
}