rxdart

How can you Sort a stream by timestamp in Reactivex?

廉价感情. 提交于 2021-02-11 13:37:15
问题 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:/

How to filter a list of obseravble in rxdart

房东的猫 提交于 2021-02-08 19:41:59
问题 I am trying to implement bloc pattern in rxdart . I am trying to build todo app type of app . I implemented showing all items in list but what I want is not to show completed and uncompleted items in different part . However I am not able to filter the items based on completed on rxdart . import 'package:rxdart/rxdart.dart'; import '../models/ShoppingItem.dart'; class ShoppingItemBloc { final _shoppingItems = BehaviorSubject<List<ShoppingItem>> (seedValue: []); Observable<List<ShoppingItem>>

How to filter a list of obseravble in rxdart

梦想的初衷 提交于 2021-02-08 19:39:10
问题 I am trying to implement bloc pattern in rxdart . I am trying to build todo app type of app . I implemented showing all items in list but what I want is not to show completed and uncompleted items in different part . However I am not able to filter the items based on completed on rxdart . import 'package:rxdart/rxdart.dart'; import '../models/ShoppingItem.dart'; class ShoppingItemBloc { final _shoppingItems = BehaviorSubject<List<ShoppingItem>> (seedValue: []); Observable<List<ShoppingItem>>

How can i make a new stream of other streams returning a list of all the values emitted (bloc pattern)?

别来无恙 提交于 2021-01-29 10:40:15
问题 I have three streams like this: final _light1RoomCtlr = BehaviorSubject<String>(); final _light2RoomCtlr = BehaviorSubject<String>(); final _light3RoomCtlr = BehaviorSubject<String>(); Stream<String> get getLight1Room => _light1RoomCtlr.stream; Function(String) get setLight1Room => _light1RoomCtlr.sink.add; Stream<String> get getLight2Room => _light2RoomCtlr.stream; Function(String) get setLight2Room => _light2RoomCtlr.sink.add; Stream<String> get getLight3Room => _light3RoomCtlr.stream;

Observable is deprecated in rxdart 0.23.1

穿精又带淫゛_ 提交于 2020-08-22 07:31:39
问题 I just upgraded to rxdart 0.23.1 and suddenly I am getting errors wherever I have used the Observable class. I have read about the breaking changes in the documentation and it has specified to use the rxdart_codemod package which I have integrated in my pubspec.yaml file and running the following command pub global activate rxdart_codemod throws the -bash: pub: command not found error. I have installed flutter properly and flutter doctor also seems to be running fine. Is there some other

Observable is deprecated in rxdart 0.23.1

為{幸葍}努か 提交于 2020-08-22 07:31:07
问题 I just upgraded to rxdart 0.23.1 and suddenly I am getting errors wherever I have used the Observable class. I have read about the breaking changes in the documentation and it has specified to use the rxdart_codemod package which I have integrated in my pubspec.yaml file and running the following command pub global activate rxdart_codemod throws the -bash: pub: command not found error. I have installed flutter properly and flutter doctor also seems to be running fine. Is there some other

Dart stream .asBroadcastStream memory leak

与世无争的帅哥 提交于 2020-03-04 15:34:11
问题 In our Flutter application we have memory leaks and streams not being closed. We traced the source to code such as: Rx.combineLatest(...).asBroadcastStream() The result of RxDart .combineLatest() is a single-subscription stream. Adding .asBroadcastStream() makes the stream conveniently available to our various Flutter displays. However when these displays are closed the streams being combined are still active. 回答1: From the .asBroadcastStream() documentation: The returned stream will

Dart stream .asBroadcastStream memory leak

为君一笑 提交于 2020-03-04 15:34:01
问题 In our Flutter application we have memory leaks and streams not being closed. We traced the source to code such as: Rx.combineLatest(...).asBroadcastStream() The result of RxDart .combineLatest() is a single-subscription stream. Adding .asBroadcastStream() makes the stream conveniently available to our various Flutter displays. However when these displays are closed the streams being combined are still active. 回答1: From the .asBroadcastStream() documentation: The returned stream will

How to call a method from InheritedWidget only once?

删除回忆录丶 提交于 2019-12-23 11:36:09
问题 I'm developing with reactive components streams/observables with Rx_command, Rx_dart Problem: In my Flutter app I have inherited widget that can be called anywhere with: FooProvider.of(context).foo.method1... I need to make a first call to the method when the UI loads at first time I can't use init.state because it's impossible I use didchangedependencies it works but.. ... every time the ui reloads, the didchangedependencies is called and the method is executed once again. I don't want it to

implementing simple rxDart with Bloc don't get result

我是研究僧i 提交于 2019-12-11 16:45:34
问题 from this link on my web server as http://instamaker.ir/api/v1/getPersons i'm trying to get result and printing avatar from that result, unfortunately my implementation with rxDart and Bloc don't get result from this response and i don't get any error server response this simplified result: { "active": 1, "name": "my name", "email": " 3 ", "loginType": " 3 ", "mobile_number": " 3 ", ... "api_token": "1yK3PvAsBA6r", "created_at": "2019-02-12 19:06:34", "updated_at": "2019-02-12 19:06:34" }