Issue I have final _fetcher = PublishSubject<MyModel>() ; in my bloc Component. Here is structure of MyModel: MyModel { List<MyObjects> _objects = []; List<MyObjects> get allObjects => _objects; } also there is Observable<MyModel> get myObjects => _fetcher.stream; in bloc. I
Continue readingTag: rxdart
Flatten multiple streams, with events of only of the last stream
Issue x is a stream. On each event, I generate a stream x_i that itself spawns events. From this set up, I want to generate a flattened output stream that contains only events of the most recent x_i, until x
Continue readingcreate RxCommand with two combined streams
Issue I have a form with two inputs: name & address and a save button. So i’ve created a change and isValid commands for each final _nameChangedCommand = RxCommand.createSync<String, String>((x) => x); final _isNameValidCommand = RxCommand.createSync<String, bool>((x) => x !=
Continue readingFlutter – Will BLoC stream instances cause memory leak when a widget is closed?
Issue There are some scenarios where screens with their respective BLoCs are frequently created and closed. So I’m somewhat concerned about memory safety of the Streams instances created in this process, because it doesn’t seem they are disposed somewhere or
Continue readingHow to conditionally add an error to an Observable in RxDart?
Issue Using a Dart StreamTransformer, I can evaluate a stream value and choose to emit it based on some condition (e.g. sink.add(value)), or add an error (e.g. sink.addError(‘Enter a valid number’)). How would I do best do this using RxDart’s
Continue readingRxDart, mapping each item of a list to another object coming from a never ending stream
Issue I’ve been trying to find a nice way of doing this but I had no luck. Here is a simplified version of the problem: import ‘package:rxdart/rxdart.dart’; /// Input a list of integers [0,1,2,3,4] /// map each of those integers
Continue readingWhat type should I use in an Rx stream for notifications purpose?
Issue I build a flutter app using RxDart and I want to create a stream of click events. What type should this stream contain? bool would probably work for me, but I’ll always stream trues. Is there any best practice?
Continue readingStream.last callback never firing
Issue I’m writing my Flutter app with a BLoC pattern. And what I want is pretty simple: show a TextField with the last value from a stream as an initial value. There is the simple bloc: class MyBloc { BehaviorSubject<String>
Continue readingStreamBuilder receives only last item from stream
Issue My ApplicationBloc is the root of the widget tree. In the bloc’s constructor I’m listening to a stream from a repository that contains models decoded from JSON and forwarding them to another stream which is listened to by StreamBuilder.
Continue readingRX: Handling Errors in combineList
Issue I’m using the combinedLatest2 in RxDart but I’m still confused about it. This is my code: final validator = StreamTransformer<String, String>.fromHandlers( handleData: (data, sink) => data.isNotEmpty ? sink.add(data) : sink.addError(‘Cannot be empty.’)); final _subject1 = BehaviorSubject<String>(); final stream1 =
Continue reading