Closed ThinkDigitalSoftware closed 4 years ago
Streams allow for data to be automatically fetched asynchronously when the backing data store is exhausted (e.g., a user has iterated over 100 comments, the next 100 comments need to be fetched from the network). You can get a list from a Dart stream by calling stream.toList()
or you can simply loop over the stream to build a list yourself:
final list = [];
await for (final value in stream) {
list.add(value);
}
I'm used to getting a list of say, posts, rather than a stream that returns a single value at a time. Is there a reason for this?