create static method

Versions create({
  1. bool schemeUtilsIsSetDefaultData = false,
  2. String? version,
  3. String? status,
  4. bool? hasdocumentation,
  5. String special_type = "versions",
  6. Pubspec? pubspec,
  7. String? archive_url,
  8. String? archive_sha256,
  9. String? published,
})
override

return original data json

Implementation

static Versions create({
  bool schemeUtilsIsSetDefaultData = false,
  String? version,
  String? status,
  bool? hasdocumentation,
  String special_type = "versions",
  Pubspec? pubspec,
  String? archive_url,
  String? archive_sha256,
  String? published,
}) {
  // Versions versions = Versions({
  final Map versions_data_create_json = {
    "version": version,
    "status": status,
    "hasDocumentation": hasdocumentation,
    "@type": special_type,
    "pubspec": (pubspec != null) ? pubspec.toJson() : null,
    "archive_url": archive_url,
    "archive_sha256": archive_sha256,
    "published": published,
  };

  versions_data_create_json.removeWhere((key, value) => value == null);

  if (schemeUtilsIsSetDefaultData) {
    defaultData.forEach((key, value) {
      if (versions_data_create_json.containsKey(key) == false) {
        versions_data_create_json[key] = value;
      }
    });
  }
  return Versions(versions_data_create_json);
}