问题
I've combined streams from firestore and now I need to sort them by timestamp (descending) . I really don't know much about reactiveX ...I'm using dartRx. I seen a few solutions using a comparator but not really sure how to use it.
Class Order{
Timestamp timestamp;
}
Stream<List<Order>> sortByTimestamp(){
return combineList(order).....//my stream
}
回答1:
thanks for your question. Here is my way :)
return combineList(order).map((orders) => orders.sort(comparator).toList());
来源:https://stackoverflow.com/questions/62986854/how-can-you-sort-a-stream-by-timestamp-in-reactivex