📱 Flutter Intermediate

What is the BLoC pattern in Flutter?

Answer

The BLoC (Business Logic Component) pattern separates business logic from the UI using streams. The UI dispatches Events to a BLoC, the BLoC processes the event and emits a new State, and the UI rebuilds in response to the new state. The flutter_bloc package makes this concrete with Cubit (simpler, state-based) and Bloc (full event-to-state mapping). BLoC excels in large teams because the business logic is completely decoupled and easily testable.