Attachment.fromJson constructor

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

Implementation

factory Attachment.fromJson(Map<String, Object?> json) {
  return Attachment(
    author: json[r'author'] != null
        ? UserDetails.fromJson(json[r'author']! as Map<String, Object?>)
        : null,
    content: json[r'content'] as String?,
    created: DateTime.tryParse(json[r'created'] as String? ?? ''),
    filename: json[r'filename'] as String?,
    id: json[r'id'] as String?,
    mimeType: json[r'mimeType'] as String?,
    self: json[r'self'] as String?,
    size: (json[r'size'] as num?)?.toInt(),
    thumbnail: json[r'thumbnail'] as String?,
  );
}