Skip to content

Instantly share code, notes, and snippets.

@chimon2000
Created November 1, 2020 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chimon2000/36296a2833935874e25ba368c68f2388 to your computer and use it in GitHub Desktop.
Save chimon2000/36296a2833935874e25ba368c68f2388 to your computer and use it in GitHub Desktop.
state_examples: notes cubit
class NotesCubit extends Cubit<NotesState> {
NotesCubit(): super(NotesState.initial());
void addNote() {
emit(state.copyWith(notes: state.notes.concat(state.input), input: ''));
}
void updateInput(String input) => emit(state.copyWith(input: input));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment