toJson method

Map<String, dynamic> toJson()

Converts this model to a JSON map.

Implementation

Map<String, dynamic> toJson() {
  return {
    'id': id,
    'name': name,
    if (description != null) 'description': description,
    'type': type.toJson(),
    'nsfw': nsfw,
    'poi': poi,
    if (mode != null) 'mode': mode,
    if (creator != null) 'creator': creator!.toJson(),
    'tags': tags,
    'modelVersions': modelVersions.map((e) => e.toJson()).toList(),
    if (stats != null) 'stats': stats!.toJson(),
    if (imageUrl != null) 'imageUrl': imageUrl,
    if (createdAt != null) 'createdAt': createdAt!.toIso8601String(),
    if (updatedAt != null) 'updatedAt': updatedAt!.toIso8601String(),
    if (publishedAt != null) 'publishedAt': publishedAt!.toIso8601String(),
    if (status != null) 'status': status!.toJson(),
    if (earlyAccessEnabled != null) 'earlyAccessEnabled': earlyAccessEnabled,
    if (downloadUrl != null) 'downloadUrl': downloadUrl,
  };
}