Flutter › State Management with BLoC & Cubit

What is Cubit, and how does it provide a genuinely simplified alternative to the full BLoC pattern by directly exposing simple methods rather than requiring you to properly define genuinely separate distinct event classes?

Beginner

Answer

Cubit is a genuinely simplified variant belonging to the exact same overall BLoC family, letting you directly call a genuinely simple regular method to properly emit a brand new state, rather than needing to first dispatch a genuinely separate distinct event object that a corresponding BLoC would then need to properly process, and Cubit is generally genuinely well suited for considerably simpler state management needs where the genuinely additional formality and structure of full BLoC's own event based approach would otherwise feel like genuinely unnecessary added complexity for what is really quite a fairly straightforward specific use case.
class CounterCubit extends Cubit<int> {
  CounterCubit() : super(0);
  void increment() => emit(state + 1);
}
Real-world example A genuinely simple theme toggle feature uses a considerably lighter weight Cubit rather than a full BLoC, since directly calling a simple toggleTheme method feels genuinely more appropriate and considerably less heavyweight for such a genuinely straightforward particular use case.

Common follow-ups: When would you genuinely choose full BLoC over the considerably simpler Cubit for a given specific particular feature?;Can a Cubit genuinely be later properly upgraded into a full BLoC if that particular feature's own requirements genuinely happen to grow more complex over time?