Flutter

Streams & RxDart

Stream, StreamController, StreamBuilder, rxdart operators, BehaviorSubject, combineLatest

24 питань зі співбесід·
Senior
1

What is a Stream in Dart?

Відповідь

A Stream is an asynchronous sequence of data that allows receiving values over time, unlike a Future which returns only a single value. Streams are particularly useful for handling user events, real-time data, or continuous data flows like WebSockets.

2

What is the difference between a Single-subscription Stream and a Broadcast Stream?

Відповідь

A Single-subscription Stream can only have one listener at a time and retains events until listened to. A Broadcast Stream allows multiple simultaneous listeners but doesn't retain past events for new subscribers. The choice depends on the use case: file or HTTP for single, UI events for broadcast.

3

How to create a simple Stream from a list of values in Dart?

Відповідь

Stream.fromIterable() creates a Stream from an existing collection, emitting each element asynchronously. This method is ideal for converting synchronous data into an asynchronous stream, for example to simulate data or for code uniformity with other data sources.

4

Which method should be used to listen to data from a Stream?

5

How to convert a Single-subscription Stream to a Broadcast Stream?

+21 питань зі співбесід

Опануй Flutter для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно