🐛 Fix nullable link preview meta fields

This commit is contained in:
2025-06-21 16:52:10 +08:00
parent 4ba809a8d6
commit b39248cc58
4 changed files with 59 additions and 57 deletions

View File

@ -10,13 +10,16 @@ _SnEmbedLink _$SnEmbedLinkFromJson(Map<String, dynamic> json) => _SnEmbedLink(
type: json['Type'] as String,
url: json['Url'] as String,
title: json['Title'] as String,
description: json['Description'] as String,
imageUrl: json['ImageUrl'] as String,
description: json['Description'] as String?,
imageUrl: json['ImageUrl'] as String?,
faviconUrl: json['FaviconUrl'] as String,
siteName: json['SiteName'] as String,
contentType: json['ContentType'] as String,
author: json['Author'],
publishedDate: json['PublishedDate'],
contentType: json['ContentType'] as String?,
author: json['Author'] as String?,
publishedDate:
json['PublishedDate'] == null
? null
: DateTime.parse(json['PublishedDate'] as String),
);
Map<String, dynamic> _$SnEmbedLinkToJson(_SnEmbedLink instance) =>
@ -30,5 +33,5 @@ Map<String, dynamic> _$SnEmbedLinkToJson(_SnEmbedLink instance) =>
'SiteName': instance.siteName,
'ContentType': instance.contentType,
'Author': instance.author,
'PublishedDate': instance.publishedDate,
'PublishedDate': instance.publishedDate?.toIso8601String(),
};