Created
July 13, 2020 10:22
-
-
Save shivanchalaeologic/b8abfbcf69a2f9c2195816b43296286e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:cubit/cubit.dart'; | |
| class CounterCubit extends Cubit<int> { | |
| CounterCubit() : super(1); | |
| void increment() { | |
| emit(state + 1); | |
| } | |
| void decrement() { | |
| if (state > 1) emit(state - 1); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment