Dart Computer Programming for Intermediates: 08 Await for versus Listen

Опубликовано: 24 Март 2019
на канале: Dash to Dartlang
776
21

await for and listen are both methods used to access Streams in Dart.

await for - when you need to hold everything up, and need to Stream to finish. When there is a small, finite set of data.
listen - BroadcastStreams. Not blocking. Potentially large amount of data.
async - when you wait for at most 1 piece of data.
async* - when expecting more than 1 piece of data.