ReleasePackerCommandUploadReleaseBundle.fromJson constructor

ReleasePackerCommandUploadReleaseBundle.fromJson(
  1. Object json
)

Implementation

factory ReleasePackerCommandUploadReleaseBundle.fromJson(Object json) {
  String? file;
  String? release;

  if (json is Map) {
    var map = json.asJsonMap;

    file = map.get('file');
    release = map.get('release');

    var gcs = map.get<Map>('gcs');
    if (gcs != null) {
      var cmd = ReleasePackerCommandGCS.fromJson(gcs);

      return ReleasePackerCommandUploadReleaseBundle.byGCS(
          cmd.project, cmd.bucket,
          credential: cmd.credential,
          parameters: cmd.parameters,
          file: file,
          release: release);
    }
  }

  var cmd = ReleasePackerCommandURL.fromJson(json);

  return ReleasePackerCommandUploadReleaseBundle.byURL(cmd.url,
      parameters: cmd.parameters,
      authorization: cmd.authorization,
      file: file,
      release: release);
}