WARNING: This is highly experimental
A cubit is a reimagined bloc (from package:bloc) which removes events and relies on methods to emit new states instead.
Package | Pub |
---|---|
cubit | |
cubit_test | |
flutter_cubit |
class CounterCubit extends Cubit<int> {
CounterCubit() : super(initialState: 0);
void increment() => emit(state + 1);
void decrement() => emit(state - 1);
}
- Dart 2: >= 2.7.0