Skip to content

Instantly share code, notes, and snippets.

@shivanchalaeologic
Created July 13, 2020 10:22
Show Gist options
  • Select an option

  • Save shivanchalaeologic/b8abfbcf69a2f9c2195816b43296286e to your computer and use it in GitHub Desktop.

Select an option

Save shivanchalaeologic/b8abfbcf69a2f9c2195816b43296286e to your computer and use it in GitHub Desktop.
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