Implementation
Subreddit convertFromReddit(draw.Subreddit sub) {
String? banner = nullIfEmpty(sub.data?["mobile_banner_image"])
?? nullIfEmpty(sub.data?["banner_background_image"])
?? nullIfEmpty(sub.data?["banner_img"]);
return Subreddit(
id: sub.id,
description: sub.data?["public_description"],
title: sub.displayName,
fullName: sub.displayName,
iconImage: nullIfEmptyUri(sub.iconImage) != null ? HtmlUnescape().convert(sub.iconImage.toString()) : null,
bannerImage: banner != null ? HtmlUnescape().convert(banner) : null,
over18: sub.over18,
subscriberCount: sub.data?["subscribers"],
activeUserCount: sub.data?["active_user_count"],
);
}