Questions tagged [dart-stream]
22 questions
3
votes
0 answers
Riverpod Stream Provider Testing in Pure Dart
I'm struggling with writing a test for a Stream Provider. It can obviously be done, but I'm kind of new to using Mocks, and I haven't figured out a way to get it to work. Here's what I have so far:
@Riverpod(keepAlive: true)
class AtFhirListen…

Grey
- 331
- 3
- 11
2
votes
2 answers
listen for stream and print value in dart main function
I want to print data.length after listening to this stream but the program executed synchronously. How can I listen to this data stream without using the await-for syntax
void main() async {
final file = File('assets/text_long.txt');
final…

zex_rectooor
- 692
- 7
- 26
2
votes
1 answer
RxDart BehaviorSubject alternative in Native Dart Streams
I am looking for an alternative of BehaviorSubject from RxDart in Native Dart Streams. To be more particular: I want to get the previously added value to the Stream when I listen to.
Example flow: 1 -> 2 -> 3 -> * -> 4 -> 5 ...
* is point when I…

Rza İsmayıl
- 370
- 1
- 2
- 7
2
votes
3 answers
Dart Streams - Is it possible to map to a new async stream?
I might be getting confused with dart streams and RX related frameworks here.
But just wanted to check, is it possible to map to a new async stream?
For example
apiService.signInStream returns Stream
apiService.getUserDetailsStream…

aidanmack
- 518
- 1
- 5
- 16
1
vote
0 answers
Stream doesn't recognize the change in Database
I am building note application which stores notes in database (I am using floor).
My stream is listening data in database and every change that is occurred it will automatically rebuild the screen.
My problem is that when I implement the logic for…

JtrProgg
- 21
- 2
1
vote
0 answers
Dart Stream Not Cancelling
I have a class that contains a stream that listens for objects to be created.
class Conversation {
// variables for live query
late QueryBuilder message_live_query_;
final LiveQuery live_query = LiveQuery(debug: true);
//…

OBurnsy22
- 29
- 3
1
vote
1 answer
Exactly why and when are StreamController constructor functions onListen, onPause, onResume, and onCancel called?
In Dart/Flutter, I have a StreamController defined like this:
MyEventStreamer() {
_controller = StreamController(
onListen: _startStream,
onResume: () {
throw UnimplementedError();
},
…

Nerdy Bunz
- 6,040
- 10
- 41
- 100
1
vote
1 answer
How to create a StreamController from a database Stream using StreamTransformer
I am trying to transform a stream from a database with the database data model to the domain data model.
I am quite confused bringing the different pieces of information together. While in the StreamTransformer examples that I have found, the stream…

w461
- 2,168
- 4
- 14
- 40
0
votes
1 answer
Will the mapping do the job if the source stream is still empty?
In the following example I expected that if typeOfThingSubject was not still emited with a value than the existing not null things should be returned from else branch. Instead, in the stream builder snapshot.data is null.
// in bloc…

rozerro
- 5,787
- 9
- 46
- 94
0
votes
0 answers
When to call dispose on global streams and stream controllers in Flutter App
I have couple of streams which are to be used across all the flutter screens. I initialise them before first screen and as and when needed. But now if I don't dispose them, since they are to used as long as user is using the application will they…

raphire
- 198
- 9
0
votes
1 answer
Get a stream from Firebase with flutter
My goal is to query Firebase and return a stream that automatically updates in case is added to the collection that fulfils the where() statement.
Stream getUsers(String storeLocation) async* {
Stream> users =…

Stereo
- 1,148
- 13
- 36
0
votes
1 answer
How to restart async function in bloc while it's working?
There is a simple bloc, which uses rxdart controller. It does nothing but streaming srings in general. There is a logic in it to start reading again.
class ReaderBloc {
bool started = false;
final _publishStream = PublishSubject();
…

rozerro
- 5,787
- 9
- 46
- 94
0
votes
1 answer
Flutter: How can I make a stream produce objects in periodic manner?
I have this function that aims at producing a Quote object after every 5 seconds.
Stream
quotesStream(Realm populatedRealm) async* { Listquotes = populatedRealm.all().toList(); for (Quote aQuote in quotes) { // Wait…

Amani
- 16,245
- 29
- 103
- 153
0
votes
0 answers
How to catch a flutter cloud firestore permission-denied error with a stream
I'm noticing an issue where I can't catch a permission-denied error from cloud firestore with a stream in a flutter app.
I have this repository which is supposed to generate a stream of documents, and I have my security rules set to prevent all…

Charlie Page
- 541
- 2
- 17
0
votes
3 answers
Stream of millions of objects takes too much memory
I'm generating a load of coordinates (made of 3 numbers) within a geographical area. However, using Streams (which should be much more efficient than Lists), fills up the app's memory very quickly, as can be seen in this screenshot from…

JaffaKetchup
- 1,151
- 10
- 26