Questions tagged [rxdart]

Reactive extensions on top of Dart streams.

Provides Reactive extensions on top of Dart streams.

Similar to RXjs

https://pub.dartlang.org/packages/rxdart

325 questions
8
votes
1 answer

Flutter - Will BLoC stream instances cause memory leak when a widget is closed?

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…
First_Strike
  • 1,029
  • 1
  • 10
  • 27
7
votes
1 answer

Not able to listen to a broadcast Stream

My standard stream: var stream = (StreamController()..add(1)).stream; stream.listen(print); // prints 1 My broadcast stream: var stream = (StreamController.broadcast()..add(1)).stream; stream.listen(print); // doesn't print anything
iDecode
  • 22,623
  • 19
  • 99
  • 186
7
votes
1 answer

How to do backend validation using BLOC pattern in Flutter TextField?

I want to create a TextField that check if the value exist in database. How to do async validation using BLOC pattern with TextField widget? Should I use StreamTransformer to add error to the Stream? I tried using DebounceStreamTransformer but it's…
6
votes
4 answers

rx dart combine multiple streams to emit value whenever any of the streams emit a value

In RX dart there is the RX.combineLatest method to combine the results of a stream using a callback function. Problem is that it only emits a value when every stream has emitted a value. If one has not it does not emit. Merges the given Streams…
Code Spirit
  • 3,992
  • 4
  • 23
  • 34
6
votes
1 answer

Effects of Injecting BLoC as a singleton using DI and where to close stream?

I am using inject.dart to inject my bloc as a singleton, is it a bad practice i.e that causes memory leak? Since all the streams I am using are Broadcast Streams from RxDart I was wondering if a singleton would work better? And if not a bad…
Ajay Rn
  • 93
  • 7
6
votes
4 answers

Convert Stream> to Stream

I am using rxdart package to handle stream in dart. I am stuck in handling a peculiar problem. Please have a look at this dummy code: final userId = BehaviorSubject(); Stream getStream(String uid) { // a sample code that returns a…
Dipu
  • 6,999
  • 4
  • 31
  • 48
6
votes
1 answer

How to filter a list of obseravble in rxdart

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…
ashok poudel
  • 703
  • 11
  • 28
5
votes
1 answer

BehaviorSubject adding the same value

Hi I have a BehaviorSubject with a simple type int, I add the value 5 to it and then add another value 5. The stream listener sent me two events. How to force check the values and not send an event if the value is equal to the last value. Sample…
Anton Molchan
  • 563
  • 5
  • 16
5
votes
2 answers

Use Spread Operator on Object with Type Safety in Dart

I would like to use the Spread operator (...) on key-value-data with type safety. In TypeScript I would achieve this with Interfaces, but I could not figure out a way of doing this in dart. Failed approach 1: Use Classes class Foo { int aNumber; …
Christoph Bühler
  • 2,795
  • 2
  • 28
  • 43
5
votes
2 answers

Loading data on init with BLoC

New to Flutter with BLoC. Building off of a search template, looking to have data (items) load on app load instead of on state change. The method getCrystals() returns the correct data when the search intent .isEmpty but how can it be done on app…
JMP
  • 557
  • 1
  • 6
  • 17
5
votes
2 answers

Flutter Combine Multiple FireStore Streams With Rxdart

I think I need to merge it together somewhere, but I can't find out how and where. I want to use in StreamBuilder ? I brought you up here waiting for your help.. getCombinedMatches(uid) { return Firestore.instance .collection('matches') …
Namus Keyfe
  • 87
  • 11
5
votes
1 answer

Flutter Streams, how to access previously emitted data from the stream

I have a stream builder, and i want to access the previously emitted value from the stream. If one is familiar with distinct, they must know that distinct basically checks if previous and current value is the same. I want access to the previous…
GoPro
  • 642
  • 1
  • 10
  • 24
5
votes
2 answers

Test widget using the BLoC pattern

I have been learning Flutter/Dart and the BLoC Pattern. I used this article as my starting point: https://www.didierboelens.com/2018/08/reactive-programming---streams---bloc/ I have the bloc class and widget working, but I can't figure out how to…
jj.
  • 2,210
  • 3
  • 21
  • 22
5
votes
1 answer

How to call a method from InheritedWidget only once?

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…
Paulo Bruckmann
  • 331
  • 4
  • 7
4
votes
2 answers

Flutter getx first null value

Hello there dear internet, and thank you for getx, I have a question regarding getx rx flow &/ getx initial. I am new to getx, but a veteran in rxjs, where you get a value only emitted on .next(value); My question is: how can - by all means [4] -…
4F2E4A2E
  • 1,964
  • 26
  • 28
1
2
3
21 22