fetchPostDetails method

  1. @override
Future<TimelinePost> fetchPostDetails(
  1. TimelinePost post
)
override

Implementation

@override
Future<TimelinePost> fetchPostDetails(TimelinePost post) async {
  var reactions = post.reactions ?? [];
  var updatedReactions = <TimelinePostReaction>[];
  for (var reaction in reactions) {
    updatedReactions.add(
      reaction.copyWith(
        creator: const TimelinePosterUserModel(
          userId: 'test_user',
          imageUrl:
              'https://cdn.britannica.com/68/143568-050-5246474F/Donkey.jpg?w=400&h=300&c=crop',
          firstName: 'Dirk',
          lastName: 'lukassen',
        ),
      ),
    );
  }
  var updatedPost = post.copyWith(reactions: updatedReactions);
  posts = posts.map((p) => (p.id == post.id) ? updatedPost : p).toList();
  notifyListeners();
  return updatedPost;
}