Created
November 1, 2020 06:10
-
-
Save chimon2000/36296a2833935874e25ba368c68f2388 to your computer and use it in GitHub Desktop.
state_examples: notes cubit
This file contains 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
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