getTrendingSpaceInboxList function

Future<List<SpaceFeeds>> getTrendingSpaceInboxList({
  1. required List<SpaceFeeds> feedsList,
})

Implementation

Future<List<SpaceFeeds>> getTrendingSpaceInboxList({
  required List<SpaceFeeds> feedsList,
}) async {
  final List<SpaceFeeds> feedsOutputlist = [];
  for (var feed in feedsList) {
    Message? message;
    if (feed.threadhash != null) {
      message = await getCID(cid: feed.threadhash!);
    }

    // This is for groups that are created without any message
    message ??= Message(
      encType: 'PlainText',
      encryptedSecret: '',
      fromCAIP10: '',
      fromDID: '',
      link: '',
      messageContent: '',
      messageType: '',
      sigType: '',
      signature: '',
      toCAIP10: '',
      toDID: '',
    );

    feed.msg = message;

    feedsOutputlist.add(feed);
  }
  return feedsOutputlist;
}