apped by { } - eg. getUrl(int color, [int favNum]) - Positional - Parameters wrapp
ed by [ ]) - eg. getUrl(int color, {int favNum}) - Default - Assigning a default v
alue to a parameter. - eg. getUrl(int color, [int favNum = 6])
Q11: Explain the different types of Streams?
GET START
Mid Top 68 Flutter Interview Questions Flutter 68
Answer
There are two kinds of streams. 1. Single subscription streams - The most common kind of stream. - It contains
a sequence of events that are parts of a larger whole. Events need to be delivered in the correct order and
without missing any of them. - This is the kind of stream you get when you read a file or receive a web request. -
Such a stream can only be listened to once. Listening again later could mean missing out on initial events, and
then the rest of the stream makes no sense. - When you start listening, the data will be fetched and provided in
chunks.
Broadcast streams
It intended for individual messages that can be handled one at a time. This kin
d of stream can be used for mouse events in a browser, for example.
You can start listening to such a stream at any time, and you get the events th
at are fired while you listen.
More than one listener can listen at the same time, and you can listen again la
ter after canceling a previous subscription.
Dostları ilə paylaş: