Upgrade to remove ads
Terms in this set (7)
What is a stream?
A stream is a sequence of asynchronous events. It is like an asynchronous Iterable—where, instead of getting the next event when you ask for it, the stream tells you that there is an event when it is ready.
using what can a Stream be processed?
via the asynchronous for loop (commonly just called await for) that iterates over the events of a stream like the for loop iterates over an Iterable.
what should you add to the function declaration whenever you're using Streams?
The function is marked with the async keyword, which is required when using the await for loop.
What will usually happen if the Stream receives an error event? What are the other possible scenarios?
The Stream will stop if it receives an error event.
The other possible scenarios : 1) Stream will continue if it receiving data events after an error 2) Stream can deliver multiple error events one after the other
What are the 2 types of Streams? What are they used for, who can listen to them and for how long?
1) Single subscription - used for reading / writing data - the data has to come in the correct order or the rest of the stream will make no sense. This kind of Stream can be listened to only once, cause listening to it later might not make sense (since some pieces of the Stream might be missing)
2) Broadcast - used for individual messages that can be handled one at a time (for mouse clicks for example).
You can listen to it at any time and get the events that are fired when you listen. More than one listener can listen to this stream and you can re-subscribe again after cancelling the previous subscription.
How can you start getting events from the Stream?
via the listen() method
What is a Stream until you call a listen() on it? What object do you get after you call listen? What can you do with it?
Until you listen a Stream is an inert object that just describes what you events you want to listen to.
Once you call listen() you will get a StreamSubscription that represents the active stream producing events.
With StreamSubscription you can pause receiving the events, resume after pause and cancel completely. You can also set callbacks to be called for various events.
YOU MIGHT ALSO LIKE...
stat200 notes on probability
Stats Chapter 4
Mutually Exclusive & Inclusive Events
Bluman Elementary Statistics Chapter 4: All Terms
OTHER SETS BY THIS CREATOR
13. Lambda with Receiver
11. Inline functions
OTHER QUIZLET SETS
Art test 2
Path: inflammation and repair