BLoC (Business Logic Component) tách logic nghiệp vụ khỏi UI thông qua kiến trúc event-in/state-out.
- Bạn dispatch
Eventvào BLoC, BLoC xử lý và emit raStatemới. - BLoC có thể test được, đảm bảo kiến trúc nhất quán, và scale tốt trong team lớn.
- BLoC cần boilerplate nhiều hơn Provider nhưng cung cấp cấu trúc và khả năng truy vết tốt hơn cho app phức tạp.
BLoC (Business Logic Component) separates business logic from UI via an event-in/state-out architecture.
- You dispatch
Events into a BLoC, which processes them and emits newStates. - BLoCs are testable, enforce consistent architecture, and scale well on large teams.