Future đại diện cho một giá trị bất đồng bộ duy nhất sẽ có trong tương lai — giống như một lời hứa cho một kết quả. Stream đại diện cho nhiều sự kiện bất đồng bộ theo thời gian — như một chuỗi các giá trị liên tục.
Dùng Future cho tác vụ một lần (gọi API), dùng Stream cho dữ liệu liên tục (cảm biến, WebSocket).
A Future represents a single asynchronous value that will be available in the future.
- A
Streamrepresents multiple asynchronous events over time. - Use
Futurefor single operations like API calls,Streamfor continuous data like sensor readings or WebSocket messages.