From 6c650969cbded912480d61385a14b4278c2be26b Mon Sep 17 00:00:00 2001 From: Hoang Btmrk Date: Mon, 6 May 2024 11:30:52 +0700 Subject: [PATCH] fix: refactor code --- lib/util/asset_token_ext.dart | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lib/util/asset_token_ext.dart b/lib/util/asset_token_ext.dart index 356b65749..2a1af1784 100644 --- a/lib/util/asset_token_ext.dart +++ b/lib/util/asset_token_ext.dart @@ -54,12 +54,8 @@ extension AssetTokenExtension on AssetToken { if (title == null) { return null; } - final displayTitle = title ?? ''; - if (mintedAt != null) { - return '$displayTitle (${mintedAt!.year})'; - } - return displayTitle; + return mintedAt != null ? '$title (${mintedAt!.year})' : title; } bool get hasMetadata => galleryThumbnailURL != null; @@ -473,12 +469,8 @@ extension CompactedAssetTokenExtension on CompactedAssetToken { if (title == null) { return null; } - final displayTitle = title ?? ''; - if (mintedAt != null) { - return '$displayTitle (${mintedAt!.year})'; - } - return displayTitle; + return mintedAt != null ? '$title (${mintedAt!.year})' : title; } bool get isPostcard {