cubit 0.0.7 cubit: ^0.0.7 copied to clipboard
A cubit is a subset of package:bloc which has no notion of events and relies on methods to emit new states.
import 'package:cubit/cubit.dart';
void main() async {
final cubit = CounterCubit()..increment();
await cubit.close();
}
class CounterCubit extends Cubit<int> {
CounterCubit() : super(initialState: 0);
void increment() => emit(state + 1);
@override
void onTransition(Transition<int> transition) {
print(transition);
super.onTransition(transition);
}
}