Skip to content

Instantly share code, notes, and snippets.

@heyhey1028
Created November 11, 2022 03:27
Show Gist options
  • Save heyhey1028/04103c14e989800f7a5caeffc7a54da7 to your computer and use it in GitHub Desktop.
Save heyhey1028/04103c14e989800f7a5caeffc7a54da7 to your computer and use it in GitHub Desktop.
tips for manipulating streams in dart

tips for manipulating streams in dart

return CartOptionCategoryRepository.getAllCartOptionCategoryIDsStream(
userID: params.userID,
cartItemID: params.cartItemID,
).flatMap((cocIDs) {
return Rx.combineLatestList([
for (final cocID in cocIDs)
CartOptionRepository.getAllCartOptionsStream(
userID: params.userID,
cartItemID: params.cartItemID,
cartOptionCategoryID: cocID,
).map(
(cos) => cos.map(
(co) => SelectedCartOption(
cartOptionCategoryID: cocID,
cartOption: co,
),
),
), //selectedCartOptionのstream
]).map((event) => event.expand((el) => el).toList());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment