Worklog.fromJson constructor

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

Implementation

factory Worklog.fromJson(Map<String, Object?> json) {
  return Worklog(
    author: json[r'author'] != null
        ? UserDetails.fromJson(json[r'author']! as Map<String, Object?>)
        : null,
    comment: json[r'comment'],
    created: DateTime.tryParse(json[r'created'] as String? ?? ''),
    id: json[r'id'] as String?,
    issueId: json[r'issueId'] as String?,
    properties: (json[r'properties'] as List<Object?>?)
            ?.map((i) => EntityProperty.fromJson(
                i as Map<String, Object?>? ?? const {}))
            .toList() ??
        [],
    self: json[r'self'] as String?,
    started: DateTime.tryParse(json[r'started'] as String? ?? ''),
    timeSpent: json[r'timeSpent'] as String?,
    timeSpentSeconds: (json[r'timeSpentSeconds'] as num?)?.toInt(),
    updateAuthor: json[r'updateAuthor'] != null
        ? UserDetails.fromJson(json[r'updateAuthor']! as Map<String, Object?>)
        : null,
    updated: DateTime.tryParse(json[r'updated'] as String? ?? ''),
    visibility: json[r'visibility'] != null
        ? Visibility.fromJson(json[r'visibility']! as Map<String, Object?>)
        : null,
  );
}