Created
November 1, 2020 06:55
-
-
Save chimon2000/d3c06806934a89854b290fac87b4f931 to your computer and use it in GitHub Desktop.
state_example: mobx note store
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
part 'notes.g.dart'; | |
class Notes = NotesBase with _$Notes; | |
abstract class NotesBase with Store { | |
@observable | |
String input = ''; | |
@observable | |
ObservableList<String> notes = ObservableList(); | |
@action | |
void updateInput(String val) { | |
input = val; | |
} | |
@action | |
void addNote() { | |
notes.add(input); | |
input = ''; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment