Version.fromJson constructor

Version.fromJson(
  1. Map<String, Object?> json
)

Implementation

factory Version.fromJson(Map<String, Object?> json) {
  return Version(
    by: json[r'by'] != null
        ? User.fromJson(json[r'by']! as Map<String, Object?>)
        : null,
    when: DateTime.tryParse(json[r'when'] as String? ?? '') ?? DateTime(0),
    friendlyWhen: json[r'friendlyWhen'] as String?,
    message: json[r'message'] as String?,
    number: (json[r'number'] as num?)?.toInt() ?? 0,
    minorEdit: json[r'minorEdit'] as bool? ?? false,
    content: json[r'content'] != null
        ? Content.fromJson(json[r'content']! as Map<String, Object?>)
        : null,
    collaborators: json[r'collaborators'] != null
        ? UsersUserKeys.fromJson(
            json[r'collaborators']! as Map<String, Object?>)
        : null,
    expandable: json[r'_expandable'] != null
        ? VersionExpandable.fromJson(
            json[r'_expandable']! as Map<String, Object?>)
        : null,
    links: json[r'_links'] != null
        ? GenericLinks.fromJson(json[r'_links']! as Map<String, Object?>)
        : null,
    contentTypeModified: json[r'contentTypeModified'] as bool? ?? false,
    confRev: json[r'confRev'] as String?,
    syncRev: json[r'syncRev'] as String?,
    syncRevSource: json[r'syncRevSource'] as String?,
  );
}