I would like to make a helpfer method which takes a stream from a library (draw in this case) and changes the stream from Stream<UserContent> to Stream<Submission> and also filters the Submissions for duds.
So far I have this code but how do I return the stream now?
Stream<Submission> getSavedPosts({int limit = 20}) async* {
yield await _me!.saved(limit: limit).map((UserContent userContent) async {
try {
Submission sub = await _populateUserContent(userContent);
if (_filterPost(sub)) {
return sub;
}
} catch (err) {
print(err);
}
}); // The type 'Stream<Stream<Future<Submission?>>>' implied by the 'yield' expression must be assignable to 'Stream<Submission>'.
}